Last active
September 8, 2015 12:47
-
-
Save ShingoFukuyama/478eaff1406754a0963a to your computer and use it in GitHub Desktop.
Convert an image for Apple Watch Complications
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 | |
# Usage | |
# cd /path/to/icon-directory/ | |
# convertImageForWatch.sh target.png | |
i=0 | |
sizes=(44 40 38 36 32 28 24 22 20 18 16 14) | |
path="$1" | |
basename=${path##*/} | |
filename=${basename%.*} | |
extension=${basename##*.} | |
iconset="${filename%.*}"_iconset | |
mkdir -p $iconset | |
while [ $i -lt ${#sizes[@]} ]; do | |
newIcon=${iconset}/${filename}_${sizes[$i]}@2x.png | |
sips -Z ${sizes[$i]} $path --out ./$newIcon | |
: $[ i++ ] | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment