Created
May 16, 2016 16:10
-
-
Save stevesparks/5c9d76435b0e896bd3bdeb7e64e77362 to your computer and use it in GitHub Desktop.
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/sh | |
if [ ! -f "$1" ]; then | |
echo "Usage: $0 <input-file>" | |
exit 1 | |
fi | |
BASE=`echo $1 | cut -d . -f 1`; | |
TAIL=`echo $1 | cut -d . -f 2-`; | |
set_size_label() | |
{ | |
case "$1" in | |
40) | |
SIZE_LABEL=40pt@1x | |
;; | |
48) | |
SIZE_LABEL=24pt@2x | |
;; | |
55) | |
SIZE_LABEL=27.5pt@2x | |
;; | |
58) | |
SIZE_LABEL=29pt@2x | |
;; | |
87) | |
SIZE_LABEL=29pt@3x | |
;; | |
80) | |
SIZE_LABEL=40pt@2x | |
;; | |
88) | |
SIZE_LABEL=44pt@2x | |
;; | |
120) | |
SIZE_LABEL=40pt@3x | |
;; | |
180) | |
SIZE_LABEL=60pt@3x | |
;; | |
76) | |
SIZE_LABEL=76pt@1x | |
;; | |
152) | |
SIZE_LABEL=76pt@2x | |
;; | |
172) | |
SIZE_LABEL=86pt@2x | |
;; | |
196) | |
SIZE_LABEL=98pt@2x | |
;; | |
167) | |
SIZE_LABEL=83.5pt@2x | |
;; | |
esac | |
} | |
if [ ! -f ${BASE}/watch/ ]; then | |
mkdir -p ${BASE}/watch/ | |
fi | |
case $TAIL in | |
jpg) TAIL=png;; | |
esac | |
echo exporting watch sizes for ${BASE} ... | |
for SIZE in 48 55 58 87 80 88 172 196; do | |
set_size_label ${SIZE} | |
NEWFILE=$BASE/watch/${BASE}-${SIZE_LABEL}.${TAIL} | |
convert $1 -resize ${SIZE}x${SIZE} ${NEWFILE} | |
done | |
if [ ! -f ${BASE}/app/ ]; then | |
mkdir -p ${BASE}/app/ | |
fi | |
echo exporting app sizes for ${BASE} ... | |
for SIZE in 58 87 80 120 180 40 76 152 167; do | |
set_size_label ${SIZE} | |
NEWFILE=$BASE/app/${BASE}-${SIZE_LABEL}.${TAIL} | |
convert $1 -resize ${SIZE}x${SIZE} ${NEWFILE} | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment