Created
June 1, 2014 12:39
-
-
Save slopjong/4f0f0160862a12953efc to your computer and use it in GitHub Desktop.
Converts a single SVG or a set of SVGs to PNG
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
function convert() | |
{ | |
file="$1" | |
# remove the svg file extension and append .png | |
destination="${file%.svg}.png" | |
# -z is for launching inkscape without the gui | |
inkscape -z --export-png=$destination --export-area-drawing $file | |
} | |
export -f convert | |
if [ ! -z "$1" ] | |
then | |
convert $PWD/$1 | |
else | |
find img -name "*.svg" -exec bash -c "convert {}" \; | |
fi; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment