Skip to content

Instantly share code, notes, and snippets.

@dardo82
Last active February 2, 2016 01:39
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save dardo82/23fc11174b550074a739 to your computer and use it in GitHub Desktop.
Save dardo82/23fc11174b550074a739 to your computer and use it in GitHub Desktop.
Make ICNS from PNG
#!/bin/zsh
#mkicns.sh
FN=${1##*/}
DN=${1%/**}
BN=${FN%.*}
IS=iconset
ID=$BN.$IS
mkdir $ID
chdir $ID
i=\../$FN
for m r in 'n' '' '((n+1))' '@2x';do
for n in $(seq 4 9|grep -v 6);do
p=$((2**$m));q=$((2**$n))
o=icon_${q}x${q}${r}\.png
sips -z $p $p $i --out $o
done
done
iconutil -c icns $PWD
cd $OLDPWD;rm -fr $ID
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment