Batch convert SVG to PNG with Inkscape command line

I recently was looking for a way to batch convert a bunch of SVG vector files into PNG raster graphics. The usual suspect Imagemagick didn’t help me in the case of a vector graphics.

Looking for a solution I came across a post from forger on ubuntuforums.org. He uses the command line of the famous Inkscape vector graphics suite, so make sure inkscape is installed. Open up a terminal and type in the following two commands.

$ cd your-directory-with-the-svgs/
$ for i in *; do inkscape $i --export-png=`echo $i | sed -e 's/svg$/png/'`; done
About these ads
This entry was posted in Planet, Ubuntu and tagged , , , , , , , , . Bookmark the permalink.

2 Responses to Batch convert SVG to PNG with Inkscape command line

  1. wijaya says:

    The ‘g$’ in ‘s/svg$/png/’ is missing. As it is, Inkscape will overwrite the SVG files.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s