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
The ‘g$’ in ‘s/svg$/png/’ is missing. As it is, Inkscape will overwrite the SVG files.
Thank you for your hint! Better late than never I corrected the post 🙂
Awesome tip thanks!!!
Made a slight change to handle filenames with spaces –
for i in *; do inkscape “$i” –export-png=”`echo “$i” | sed -e ‘s/svg$/png/’`”; done
Pingback: Good application to render or convert SVG files to other file formats [ANSWERED] - Tech ABC to XYZ
This is such an elegant method. Thank you!