Created
August 28, 2019 07:01
-
-
Save hgwr/da38cd37034345f0deb96f39dd0da1b9 to your computer and use it in GitHub Desktop.
generate macOS app icons
This file contains 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 | |
# | |
# convert big png to macOS app icon sets | |
# | |
set -o errexit | |
set -o pipefail | |
set -o nounset | |
trap 'echo "Ctrl-C captured and exit."; exit 1' INT | |
trap 'echo "some error occured at $(pwd) and exit."; exit 8' SIGHUP | |
original_png="$1" | |
if [ ! -r "$original_png" ]; then | |
echo "$original_png is not readable" | |
exit 1 | |
fi | |
mkdir -p Icon.iconset | |
rm -rf -- Icon.iconset/* | |
sips -z 16 16 "$original_png" --out Icon.iconset/icon_16x16.png | |
sips -z 32 32 "$original_png" --out Icon.iconset/icon_16x16@2x.png | |
sips -z 32 32 "$original_png" --out Icon.iconset/icon_32x32.png | |
sips -z 64 64 "$original_png" --out Icon.iconset/icon_32x32@2x.png | |
sips -z 128 128 "$original_png" --out Icon.iconset/icon_128x128.png | |
sips -z 256 256 "$original_png" --out Icon.iconset/icon_128x128@2x.png | |
sips -z 256 256 "$original_png" --out Icon.iconset/icon_256x256.png | |
sips -z 512 512 "$original_png" --out Icon.iconset/icon_256x256@2x.png | |
sips -z 512 512 "$original_png" --out Icon.iconset/icon_512x512.png | |
sips -z 1024 1024 "$original_png" --out Icon.iconset/icon_512x512@2x.png | |
rm -f Icon.icns | |
iconutil -c icns Icon.iconset |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment