Skip to content

Instantly share code, notes, and snippets.

@dgraham
Created February 8, 2015 00:26
Show Gist options
  • Save dgraham/46179bc91316e97dc64d to your computer and use it in GitHub Desktop.
Save dgraham/46179bc91316e97dc64d to your computer and use it in GitHub Desktop.
png -> icns
if [ $# -ne 1 ]; then
echo "Usage: make-icns icon.png"
exit 1
fi
IMAGE=$1
OUT=`basename ${IMAGE%\.*}`.iconset
mkdir $OUT
sizes=(16 32 128 256 512)
for size in ${sizes[@]}; do
let "double = $size * 2"
sips -z $size $size $IMAGE --out $OUT/icon_${size}x${size}.png > /dev/null
sips -z $double $double $IMAGE --out $OUT/icon_${size}x${size}@2x.png > /dev/null
done
iconutil -c icns $OUT
rm -r $OUT
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment