Guest User

Bash - export SVGs to PNGs with Inkscape

a guest
Sep 23rd, 2013
173
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/bin/sh
  2. # Script for exporting SVGs to PNGs with Inkscape.
  3. # Based on code found in:
  4. # http://askubuntu.com/questions/209449/is-there-a-way-to-batch-export-svgs-to-pngs
  5.  
  6. # for each file ending with .svg
  7. for file in *.svg
  8. do
  9.     # strip the .svg part and save output as $filename
  10.     filename=`echo "${file}" | sed s/.svg//`
  11.    
  12.     # export current file to .png
  13.     /usr/bin/inkscape -z -f "${file}" -w 640 -e "$filename.png"
  14. done
RAW Paste Data