Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
generate macOS app icons
#!/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
if [ ! -r "$original_png" ]; then
echo "$original_png is not readable"
exit 1
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