Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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
share|improve this question

11 Answers 11

up vote 58 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.

share|improve this answer
What a great tip. –  drewk May 17 '10 at 14:09
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
This produces images with the svg file in the 1st quadrant. Doesn't auto crop. Trying to convert files from noun project - wish this worked. –  Alex Cook Nov 12 '12 at 20:40
It will also not scale down the image to fit everything within the specified width. –  Gatada Feb 21 '14 at 17:48

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.

share|improve this answer
It sort of has a GUI, in display. –  Ignacio Vazquez-Abrams Apr 26 '10 at 4:04
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
If librsvg2-bin isn't installed (like on OS X) this will fail. Couldn't find a way to get that installed on OS X. –  Runscope API Tools Aug 3 '12 at 18:53
This won't work well if you want to resize the SVG as it generates blurry images. –  Behrang May 23 '13 at 3:04
It doesn't convert all SVG files correctly either; at least qlmanage got all the parts of the image. –  Gatada Feb 21 '14 at 19:50

Inkscape with it's Commandline-Interface produces the best results for me:

/Applications/Inkscape.app/Contents/Resources/bin/inkscape --export-png output.png -w 1024 -h 768 input.svg

Good thing is, you can specify the exact pixel size of the resulting image, without having to mess with density.

share|improve this answer
this is working for me! - ihave a bigger SVG created with Inkscape –  matheszabi Oct 7 '13 at 21:56
This is the only method that rendered my hand-written svg correctly –  Griffin Jul 31 '14 at 23:45
Convert does not generate good PNG files from SVG. Using Inkscape is the best way I have found so far. –  ol_v_er Feb 27 at 7:43

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.

share|improve this answer
This is the only one that worked for me on Mavericks and commons.wikimedia.org/wiki/… –  Aron Ahmadia Jun 10 '14 at 1:03

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

mogrify -format png *.svg

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

share|improve this answer
mogrify is also par of ImageMagick. –  ShreevatsaR Jun 6 '11 at 8:19
Works great, but brutally slow. –  Meekohi Jan 24 '14 at 21:58
-1? Someone thinks this isn't helpful? What's the error? –  DefenestrationDay Jul 29 '14 at 20:41

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.

share|improve this answer
Even with density, the conversion does not generate an image that is as sharp as a vector image. Try Apache Batik instead. –  Behrang May 23 '13 at 3:06

Try Apache Batik.

java -jar batik-rasterizer.jar FILES

It also supports batch conversion and has many other useful options.

share|improve this answer

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).

share|improve this answer

sips — scriptable image processing system. No external binaries required.

sips -s format png mypdf.pdf --out myimage.png

Here's a script I use after a session of screen captures.

IMAGES=`ls "$PWD"/*.tiff`
  DESTINATION=`echo "$SOURCE" | sed "s/tiff/$TARGET/g"`
  sips -s format "$TARGET" "$SOURCE" --out "$DESTINATION" &2>/dev/null
share|improve this answer
Tried it, didn't produce any output. –  xApple Feb 12 '13 at 13:26
-1 The man page clearly states sips is is used to query or modify raster image files so starting from a SVG which is what the OP was asking will not work –  RobV Aug 22 '13 at 18:16

You can perform a batch conversion on an entire folder of SVG files to PNG. I used Inkscape command line interface to produce png files with a width of 80px.

find ~/desktop/toconvert '*.svg' -exec /Applications/Inkscape.app/Contents/Resources/bin/inkscape -z -w 80 -e "{}".png "{}" \;

png will be saved with original name *.png

share|improve this answer

I have made svgexport using node/npm for this, it is cross-platform and can be as simple as:

svgexport input.svg output.png
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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