Created
August 1, 2016 20:08
-
-
Save stvhwrd/baf50e0ba082ed7ec343e092bd6e4815 to your computer and use it in GitHub Desktop.
[WIP] Generates .icns package for Mac from one 1024x1024 PNG file.
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
#!/bin/bash | |
# Converts a single 1024px PNG image to a .ICNS file for best use with Mac applications | |
# Required: Icon to be converted must be on the desktop and named "icon2convert" | |
echo "" | |
ls ~/Desktop/*.png | |
echo "" | |
echo "Icons to be converted must be on the desktop." | |
echo "Which icon would you like to convert?" | |
read ICON_NAME | |
echo "Okay, converting $ICON_NAME to .icns." | |
# Name each folder for the date/time of its creation | |
NAME=icon-$(date +%Y/%m/%d-%T).iconset | |
DIR="~/Desktop/$NAME" | |
for i in `seq 1 3`; | |
do | |
echo "$i..." | |
sleep 1 | |
done | |
echo "Converting." | |
cp ~/Desktop/$ICON_NAME ~/Desktop/icon2convert.png | |
mkdir $DIR | |
sips -z 16 16 ~/Desktop/icon2convert.png --out $DIR/icon_16x16.png | |
sips -z 32 32 ~/Desktop/icon2convert.png --out $DIR/[email protected] | |
sips -z 32 32 ~/Desktop/icon2convert.png --out $DIR/icon_32x32.png | |
sips -z 64 64 ~/Desktop/icon2convert.png --out $DIR/[email protected] | |
sips -z 128 128 ~/Desktop/icon2convert.png --out $DIR/icon_128x128.png | |
sips -z 256 256 ~/Desktop/icon2convert.png --out $DIR/[email protected] | |
sips -z 256 256 ~/Desktop/icon2convert.png --out $DIR/icon_256x256.png | |
sips -z 512 512 ~/Desktop/icon2convert.png --out $DIR/[email protected] | |
sips -z 512 512 ~/Desktop/icon2convert.png --out $DIR/icon_512x512.png | |
cp icon2convert.png $DIR/[email protected] | |
iconutil -c icns $DIR | |
rm -R $DIR |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment