Today I needed to convert a huge batch of SVG images to PNG images and I started Googling. I found a lot of commanline examples of how to convert one SVG image to PNG image but didn’t find a script that would have done this to all the SVG files I have in a certain directory. I thought it can’t be hard to do that kind of shell script and it wasn’t.
Hopefully you’ll find some use for it.
# SVG2PNG # To use this you need to have librsvg installed. # Converts all the svg images in the current directory to png. # The width is hard coded (-w 600) but very easy to change. for file in *.svg do namebase=$(basename $file .svg) pngname="$namebase.png" rsvg-convert -w 600 "$file" -o "$pngname" echo "Converted $file to $pngname" done