Inkscape Batch Mode – Convert SVG to PNG tip

I’m so used to using ImageMagick’s convert command that I felt somewhat cornered when I couldn’t get a decent SVG->raster conversion. I do all my SVG work in Inkscape which can output raster files directly, but I was looking for a batch solution.

Thanks to this ubuntu forum post I realised Inkscape has a batch mode – Imagine that foresight! Bravo. This snippit did the trick, including resizing:

for i in *.svg; do inkscape -f "$i" -e "${i%%.svg*}.png" -w 640x; done

I imagine there are a bunch of other command line options but this was the first I saw, or thought, of them. That’s what happens when we use GUIs too much. I’ll now switch back to using Turtle from the command line for my graphics!


© Tyler Mitchell / Spatialguru.com