Skip to content

Instantly share code, notes, and snippets.

@ShingoFukuyama
Last active September 8, 2015 12:47
Show Gist options
  • Save ShingoFukuyama/478eaff1406754a0963a to your computer and use it in GitHub Desktop.
Save ShingoFukuyama/478eaff1406754a0963a to your computer and use it in GitHub Desktop.
Convert an image for Apple Watch Complications
#!/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