Created
July 27, 2018 23:16
-
-
Save kazkansouh/39e3dbaebfee8e0d56f333ad2fc9e1e2 to your computer and use it in GitHub Desktop.
Generate a range of PNG images of varying sizes from an SVG image
This file contains hidden or 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 | |
WIDTHS="32 64 128 256 512 1024" | |
if test -z "$#" -o "$#" -ne 1 -o ! -f "$1" ; then | |
1>&2 echo "Usage: " `basename $0` " <SVGFILE>" | |
exit 1 | |
fi | |
FILE=$1 | |
BASENAME=`basename $1` | |
BASENAME=${BASENAME%.svg} | |
OUTDIR=${FILE%.svg} | |
mkdir -p ${OUTDIR} | |
for w in ${WIDTHS} ; do | |
echo "Processing width of $w" | |
inkscape -z -e ${OUTDIR}/${BASENAME}-${w}.png -w ${w} ${FILE} | |
done | |
echo done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment