Created
August 13, 2018 03:03
-
-
Save cunneen/af1d631970598cd07dc45cb922340791 to your computer and use it in GitHub Desktop.
Make a mac OS icns file from a single input file using imageMagick and iconutil
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
#!/usr/bin/env bash | |
infile=$1 | |
if [ ! -f $infile ]; then | |
echo specify a filename as the first parameter. | |
exit 1; | |
fi | |
tempdir=$(mktemp --directory --suffix=.iconset --tmpdir=`pwd`) | |
for size in 16x16 32x32 128x128 256x256 512x512 | |
do | |
echo convert -resize "$size" $infile "${tempdir}/icon_${size}.png" | |
convert -resize "$size" $infile "${tempdir}/icon_${size}.png" | |
double=$(expr 2 \* `echo $size | cut -f1 -d'x'`) | |
echo convert -resize "${double}x${double}" $infile "${tempdir}/icon_${size}@2x.png" | |
convert -resize "${double}x${double}" $infile "${tempdir}/icon_${size}@2x.png" | |
done | |
iconutil -c icns -o ./output.icns $tempdir |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment