Skip to content

Instantly share code, notes, and snippets.

@ruthenium
Forked from dardo82/mkicns.sh
Created February 2, 2016 01:39
Show Gist options
  • Save ruthenium/b028a33eefe6f9cae888 to your computer and use it in GitHub Desktop.
Save ruthenium/b028a33eefe6f9cae888 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