Command-line application for converting SVG to PNG on Mac OS X
--
Music by Eric Matyas
https://www.soundimage.org
Track title: Puzzling Curiosities
--
Chapters
00:00 Question
00:21 Accepted answer (Score 331)
00:44 Answer 2 (Score 207)
01:11 Answer 3 (Score 70)
01:43 Answer 4 (Score 37)
02:22 Thank you
--
Full question
https://superuser.com/questions/134679/c...
Answer 1 links:
[found in brew]: https://formulae.brew.sh/formula/librsvg
Answer 2 links:
[ImageMagick]: https://www.imagemagick.org/script/downl...
Answer 3 links:
[Inkscape]: http://inkscape.org/download/
--
Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...
--
Tags
#macos #commandline #png #svg
#avk47
ACCEPTED ANSWER
Score 349
Or without installing anything:
qlmanage -t -s 1000 -o . picture.svg
It will produce picture.svg.png that is 1000 pixels wide.
I have tested it only on OS X 10.6.3.
ANSWER 2
Score 235
I found that for me the best tool for the job is rsvg-convert
.
It can be found in brew with brew install librsvg
and is used like this:
rsvg-convert -h 32 icon.svg > icon-32.png
This example creates a 32px high png. The width is determined automatically.
ANSWER 3
Score 73
ImageMagick is an extremely versatile command-line image editor, which would probably rival Photoshop if it had, you know, a GUI. But who needs those anyways. :P
Something like the following would convert a .svg to .png, after installation:
$ convert picture.svg picture.png
The original .svg isn't deleted.
ANSWER 4
Score 42
Inkscape with it's Commandline-Interface produces the best results for me:
Install Inkscape:
brew install inkscape
Convert test.svg to output.png with a width of 1024 (keep aspect ratio):
/Applications/Inkscape.app/Contents/MacOS/inkscape --export-type png --export-filename output.png -w 1024 test.svg
OLD ANSWER (doesn't work anymore with latest inkscape):
/Applications/Inkscape.app/Contents/Resources/bin/inkscape --export-png output.png -w 1024 -h 768 input.svg*