Skip to content

Instantly share code, notes, and snippets.

@yene
Forked from marcuswestin/generate-iOS-app-icons.sh
Last active December 14, 2017 14:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yene/1b5e980a1af28f4f5d37 to your computer and use it in GitHub Desktop.
Save yene/1b5e980a1af28f4f5d37 to your computer and use it in GitHub Desktop.
generate iOS icons
#!/bin/bash
# pass in the file name of the source as first parameter
mkdir -p generated
rm generated/*
# remove alpha with a simple trick
sips -s format bmp "$1" --out tmp.bmp
sips -s format png tmp.bmp --out "$1"
rm tmp.bmp
# cutting AppIcon for iOS
sips -Z 20 --out generated/icon-20@1x.png "$1"
sips -Z 40 --out generated/icon-20@2x.png "$1"
sips -Z 60 --out generated/icon-20@3x.png "$1"
sips -Z 29 --out generated/icon-29@1x.png "$1"
sips -Z 58 --out generated/icon-29@2x.png "$1"
sips -Z 87 --out generated/icon-29@3x.png "$1"
sips -Z 40 --out generated/icon-40@1x.png "$1"
sips -Z 80 --out generated/icon-40@2x.png "$1"
sips -Z 120 --out generated/icon-40@3x.png "$1"
sips -Z 57 --out generated/icon-57@1x.png "$1"
sips -Z 114 --out generated/icon-57@2x.png "$1"
sips -Z 120 --out generated/icon-60@2x.png "$1" # quality check this, iPhone < 6 icon
sips -Z 180 --out generated/icon-60@3x.png "$1" # quality check this, iPhone > 6 icon
sips -Z 50 --out generated/icon-50@1x.png "$1"
sips -Z 100 --out generated/icon-50@2x.png "$1"
sips -Z 72 --out generated/icon-72@1x.png "$1"
sips -Z 144 --out generated/icon-72@2x.png "$1"
sips -Z 76 --out generated/icon-76@1x.png "$1"
sips -Z 152 --out generated/icon-76@2x.png "$1" # quality check this, iPad icon
sips -Z 167 --out generated/icon-83.5@2x.png "$1" # quality check this, iPad Pro icon
sips -Z 1024 --out generated/icon-1024@1x.png "$1" # quality check this, it is shown in the App Store
# cutting AppIcon for watchOS
#sips -Z 48 --out generated/w-icon-24@2x.png "$1"
#sips -Z 55 --out generated/w-icon-27.5@2x.png "$1"
#sips -Z 58 --out generated/w-icon-29@2x.png "$1"
#sips -Z 87 --out generated/w-icon-29@3x.png "$1"
#sips -Z 40 --out generated/w-icon-40@1x.png "$1"
#sips -Z 88 --out generated/w-icon-44@2x.png "$1"
#sips -Z 172 --out generated/w-icon-86@2x.png "$1"
#sips -Z 196 --out generated/w-icon-98@2x.png "$1"
#sips -Z 1024 --out generated/w-icon-1024@1x.png "$1"
echo "cut all the images and placed them into the folder ./generated"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment