Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Svg rendering issue #81

Open
adamgamble opened this issue Jan 5, 2017 · 9 comments
Open

Svg rendering issue #81

adamgamble opened this issue Jan 5, 2017 · 9 comments

Comments

@adamgamble
Copy link

I think this might be a phantomjs issue, but on the off chance it isn't i'll post it here.

This svg https://www.dropbox.com/s/q3rqixk6vxxuzqw/test.svg?dl=0 loses some of the gradient detail in the lettering.

Here is what it should look like
test_svg

and here is the output from svg2png
test

Notice the difference in the gradient on the S.

@kasbah
Copy link
Contributor

kasbah commented Jan 5, 2017

This is what the SVG looks like for me on Linux Firefox 50.1

image

@adamgamble
Copy link
Author

Interesting, its using webfonts and for some reason the fonts don't load for you. Can you try chrome? It renders for me on osx in chrome/safari/firefox fine.

@domenic
Copy link
Owner

domenic commented Jan 5, 2017

The Dropbox viewer seems to give results similar to @kasbah's, but locally downloading the SVG gives results similar to the intended one on Windows Firefox/Edge/Chrome. It'd be interesting to test Safari given that WebKit is used by both PhantomJS and Safari...

@adamgamble
Copy link
Author

Whoops sorry about that. Dropbox apparently can't render svgs well :)

Here is safari's output:

test_svg

@domenic
Copy link
Owner

domenic commented Jan 5, 2017

Hmm OK. Seems very likely to be a PhantomJS issue, but maybe some of the resizing/size attribute adding that svg2png does is changing dimensions in such a way as to mess up the gradients? Worth investigating a bit, but I'm not that hopeful unfortunately.

@adamgamble
Copy link
Author

If it is a phantom js issue, do you know of any alternatives that might be able to do the same thing with?

BTW as a side note your script has made my life super easy, and I appreciate the work on it!

@domenic
Copy link
Owner

domenic commented Jan 5, 2017

Thanks for the kind words!

In the future we might be able to investigate headless Chrome of some sort. You might also try the inkscape or graphicsmagick command-line tools; in general they give inferior results but maybe for this one they'd work better.

It appears on Windows 10 Edge you can right-click > save as png. It sounds like you're on Mac though.

@kasbah
Copy link
Contributor

kasbah commented Jan 5, 2017

@adamgamble Inkscape is definitely an alternative worth investigating:

inkscape input.svg -z -e output.png

But webfonts won't work with it, for sure. The best approach might be to convert all fonts to paths first.

@adamgamble
Copy link
Author

@domenic @kasbah so i've been able to sidestep the issue by using opentype.js to convert the fonts to paths first. Then it renders correctly.

So thanks for your help!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants