Are there any command-line programs that can convert an SVG to PNG, that run on Mac OS X?

Edit: Dylan B had a good answer with ImageMagick. For reference, to install ImageMagick with SVG support on Mac OS X using MacPorts, do

port install imagemagick +rsvg
link|improve this question

feedback

5 Answers

up vote 11 down vote accepted

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.

link|improve this answer
What a great tip. – drewk May 17 '10 at 14:09
1  
Unfortunately this clips images to a square. – Martijn Pieters Jan 30 '11 at 15:13
Ah, qlmanage -t gives the thumbnail used by Quick Look (in Finder, etc). Clever idea. Unfortunately, these thumbnails can be buggy, especially when there's text involved. – ShreevatsaR Jun 6 '11 at 8:07
feedback

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.

link|improve this answer
It sort of has a GUI, in display. – Ignacio Vazquez-Abrams Apr 26 '10 at 4:04
1  
When I installed ImageMagick with Fink, I couldn't convert svg to png - there were some errors. It turned out that I needed to install librsvg2-bin as well. – tst May 21 '10 at 12:44
feedback

If you want to do many at once, you can:

mogrify -format png *.svg

There are options to resize etc on the fly, too..

link|improve this answer
mogrify is also par of ImageMagick. – ShreevatsaR Jun 6 '11 at 8:19
feedback

As commented previously ImageMagick does the trick. I just wanted to add a point for GraphicsMagick, an old fork of ImageMagick that has some improvements (and much less dependency bloat when installed via fink).

link|improve this answer
feedback

I use this command on my linux. It should work for you as well.

mogrify +antialias -density 2000 -verbose -format png *.svg

I learned that without the "-density" argument, the bitmap would be very pixelized. Change the -density value to match your need.

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.