Created
August 27, 2015 01:41
-
-
Save bryanburgers/e517e5e01b8e929fca4b to your computer and use it in GitHub Desktop.
Generate all of the png images necessary for an iOS app from a source SVG file, using Inkscape to render them.
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 | |
sizes=('29' '29@2' '29@3' '40' '40@2' '40@3' '60@2' '60@3' '76' '76@2') | |
IFS='@' | |
for size in "${sizes[@]}" | |
do | |
read -ra parts <<< "$size" | |
base=${parts[0]} | |
suffix=$base | |
size=$base | |
# If there is a second part, then it is e.g. the 2 in @2x | |
if [ ! -z ${parts[1]} ] | |
then | |
suffix="$base@${parts[1]}x" | |
size=$(expr $base \* ${parts[1]}) | |
fi | |
echo "$suffix $size" | |
/Applications/Inkscape.app/Contents/Resources/bin/inkscape -e "logo-icon-${suffix}.png" -w $size -h $size logo-icon.svg | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment