Wednesday, May 21, 2008

sed + xargs + inkscape

to make a batch exporting of SVGs to PNGs at a specific size:

foo.sh:
#!/bin/sh

PNG=`echo $1 | sed s/scalable/$2x$2/ | sed s/.svg/.png/`
DIR=`dirname $PNG`

mkdir -p $DIR
inkscape $1 --export-png=$PNG -w$2 -h$2

and at the shell:
$ find . -iname *.svg | xargs -i ./foo.sh {} 32

No comments: