Last active
December 10, 2018 13:20
-
-
Save beny/181d5ed78c3520037e355b31e11250d1 to your computer and use it in GitHub Desktop.
Icon sizes generator for iOS/watchOS/iMessage apps.
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
#!/bin/bash | |
# Sizes from https://developer.apple.com/library/ios/#qa/qa1686/_index.html | |
# Requirements: ImageMagick | |
function resize { | |
GREEN='\033[0;32m' | |
BLUE='\033[0;34m' | |
DEFAULT='\033[0m' | |
echo -e "Generating ${BLUE}$3${DEFAULT} at size ${GREEN}$2 ${DEFAULT}" | |
convert $1 -resize $2 $3 | |
} | |
if [ $1 = '-h' ]; then | |
echo "As first param use one of [iphone/ipad/ios/watchos/imessages]" | |
echo "keyword, the second param is path to the large image" | |
echo "" | |
echo "generator iphone 1024.png" | |
echo "generator ios 1024.png" | |
fi | |
# Icons for iPhone-only Applications | |
if [ $1 = 'iphone' ]; then | |
resize $2 512x512 iTunesArtwork.png # App list in iTunes | |
resize $2 1024x1024 [email protected] # App list in iTunes on devices with retina display | |
resize $2 120x120 [email protected] # Home screen on iPhone/iPod Touch with retina display | |
resize $2 180x180 [email protected] # Home screen on iPhone with retina HD display | |
resize $2 76x76 Icon-76.png # Home screen on iPad | |
resize $2 152x152 [email protected] # Home screen on iPad with retina display | |
resize $2 167x167 [email protected] # Home screen on iPad Pro | |
resize $2 40x40 Icon-Small-40.png # Spotlight | |
resize $2 80x80 [email protected] # Spotlight on devices with retina display | |
resize $2 120x120 [email protected] # Spotlight on devices with retina HD display | |
resize $2 29x29 Icon-Small.png # Settings | |
resize $2 58x58 [email protected] # Settings on devices with retina display | |
resize $2 87x87 [email protected] # Settings on devices with retina HD display | |
# Apple does not list these sizes | |
resize $2 40x40 [email protected] # iPhone notification iOS 7-11 on devices with retina display | |
resize $2 60x60 [email protected] # iPhone notification iOS 7-11 on devices with retina HD display | |
fi | |
# Icons for iPad-only Applications | |
if [ $1 = 'ipad' ]; then | |
resize $2 512x512 iTunesArtwork.png # Ad Hoc iTunes | |
resize $2 1024x1024 [email protected] # Ad Hoc iTunes on devices with retina display | |
resize $2 76x76 Icon-76.png # Home screen on iPad | |
resize $2 152x152 [email protected] # Home screen on iPad with retina display | |
resize $2 167x167 [email protected] # Home screen on iPad Pro | |
resize $2 40x40 Icon-Small-40.png # Spotlight | |
resize $2 80x80 [email protected] # Spotlight on devices with retina display | |
resize $2 29x29 Icon-Small.png # Settings | |
resize $2 58x58 [email protected] # Settings on devices with retina display | |
# Apple does not list these sizes | |
resize $2 20x20 Icon-Small-20.png # iPad notification iOS 7-11 | |
resize $2 40x40 [email protected] # iPad notification iOS 7-11 on devices with retina display | |
fi | |
# Icons for Universal Applications | |
if [ $1 = 'ios' ]; then | |
resize $2 512x512 iTunesArtwork.png # App list in iTunes | |
resize $2 1024x1024 [email protected] # App list in iTunes for devices with retina display | |
resize $2 120x120 [email protected] # Home screen on iPhone/iPod Touch with retina display | |
resize $2 180x180 [email protected] # Home screen on iPhone with retina HD display | |
resize $2 76x76 Icon-76.png # Home screen on iPad | |
resize $2 152x152 [email protected] # Home screen on iPad with retina display | |
resize $2 167x167 [email protected] # Home screen on iPad Pro | |
resize $2 40x40 Icon-Small-40.png # Spotlight | |
resize $2 80x80 [email protected] # Spotlight on devices with retina display | |
resize $2 120x120 [email protected] # Spotlight on devices with retina HD display | |
resize $2 29x29 Icon-Small.png # Settings | |
resize $2 58x58 [email protected] # Settings on devices with retina display | |
resize $2 87x87 [email protected] # Settings on devices with retina HD display | |
# Apple does not list these sizes | |
resize $2 20x20 Icon-Small-20.png # iPad notification iOS 7-11 | |
resize $2 40x40 [email protected] # iPhone/iPad notification iOS 7-11 on devices with retina display | |
resize $2 60x60 [email protected] # iPhone notification iOS 7-11 on devices with retina HD display | |
fi | |
# Icons for Watch Applications | |
if [ $1 = 'watchos' ]; then | |
resize $2 80x80 [email protected] # Home screen on Apple Watch (38mm/42mm), Long-Look notification on Apple Watch (38mm) | |
resize $2 88x88 [email protected] # Long-Look notification on Apple Watch (42mm) | |
resize $2 172x172 [email protected] # Short-Look notification on Apple Watch (38mm) | |
resize $2 196x196 [email protected] # Short-Look notification on Apple Watch (42mm) | |
resize $2 48x48 [email protected] # Notification center on Apple Watch (38mm) | |
resize $2 55x55 [email protected] # Notification center on Apple Watch (42mm) | |
resize $2 58x58 [email protected] # Settings in the Apple Watch companion app on iPhone | |
resize $2 87x87 [email protected] # Settings in the Apple Watch companion app on iPhone 6 Plus | |
fi | |
# Icons for iMessage Extensions | |
if [ $1 = 'imessage' ]; then | |
resize $2 1024x768 Messages1024x768.png # Messages App Store | |
resize $2 120x90 [email protected] # Messages app drawer on iPhone/iPod Touch with retina display | |
resize $2 180x135 [email protected] # Messages app drawer on iPhone with retina HD display | |
resize $2 134x100 [email protected] # Messages app drawer on iPad with retina display | |
resize $2 148x110 [email protected] # Messages app drawer on iPad Pro | |
resize $2 54x40 [email protected] # Breadcrumb icons in the chat transcript on devices with retina display. | |
resize $2 81x60 [email protected] # Breadcrumb icons in the chat transcript on iPhone with retina HD display | |
resize $2 64x48 [email protected] # Messages app management screen, message bubble branding on devices with retina display | |
resize $2 96x72 [email protected] # Messages app management screen, message bubble branding on iPhone with retina HD display | |
fi |
Update for iOS
if [ $1 = 'ios' ]; then
#resize $2 512x512 iTunesArtwork.png # App list in iTunes
resize $2 1024x1024 [email protected] # App list in iTunes for devices with retina display
resize $2 120x120 [email protected] # Home screen on iPhone/iPod Touch with retina display
resize $2 180x180 [email protected] # Home screen on iPhone with retina HD display
resize $2 72x72 Icon-72.png # Home screen on iPad iOS 5,6
resize $2 144X144 [email protected] # Home screen on iPad with retina display iOS 5,6
resize $2 76x76 Icon-76.png # Home screen on iPad
resize $2 152x152 [email protected] # Home screen on iPad with retina display
resize $2 167x167 [email protected] # Home screen on iPad Pro
resize $2 40x40 Icon-40.png # Spotlight
resize $2 80x80 [email protected] # Spotlight on devices with retina display
resize $2 120x120 [email protected] # Spotlight on devices with retina HD display
resize $2 29x29 Icon-29.png # Settings
resize $2 58x58 [email protected] # Settings on devices with retina display
resize $2 87x87 [email protected] # Settings on devices with retina HD display
resize $2 50X50 Icon-50.png # iPad Spotlight iOS 5,6
resize $2 100x100 [email protected] # iPad Spotlight iOS 5,6
resize $2 57X57 Icon-57.png # Home screen on iPhone iOS 5,6
resize $2 114X114 [email protected] # Home screen on iPhone with retina display iOS 5,6
# Apple does not list these sizes
resize $2 20x20 Icon-Small-20.png # iPad notification iOS 7-11
resize $2 40x40 [email protected] # iPhone/iPad notification iOS 7-11 on devices with retina display
resize $2 60x60 [email protected] # iPhone notification iOS 7-11 on devices with retina HD display
fi
I don't have ImageMagick, so I replaced it with sips:
res=`echo $2 | cut -dx -f1`
#convert $1 -resize $2 $3
sips -Z $res --out "$3" "$1"
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
There is a typo in help.
As first param use one of [iphone/ipad/ios/watchos/imessages]
should end withimessage
as the code shows.To use this awesome tool, copy the file to your computer. Open shell,