Skip to content

Instantly share code, notes, and snippets.

@lyamamot
Created August 9, 2017 16:29
Show Gist options
  • Save lyamamot/0f866c42a9230c1fb7c5dc4d77ec235c to your computer and use it in GitHub Desktop.
Save lyamamot/0f866c42a9230c1fb7c5dc4d77ec235c to your computer and use it in GitHub Desktop.
Generate placeholder icons for iOS apps that indicate their own size (in pixels).
#!/bin/bash
# https://developer.apple.com/library/content/qa/qa1686/_index.html
function create_image() {
COLOR=$1
TEXT_COLOR=$2
SIZE=$3
NAME=$4
convert -background "$COLOR" -fill white -font "Tahoma" -size $SIZEx$SIZE label:$SIZE "$NAME"
}
# Home screen on iPhone/iPod Touch with retina display
create_image '#ff0000' white 120 Icon-60@2x.png
# Home screen on iPhone with retina HD display
create_image '#ff0000' white 180 Icon-60@3x.png
# Home screen on iPad
create_image '#0000ff' white 76 Icon-76.png
# Home screen on iPad with retina display
create_image '#0000ff' white 152 Icon-76@2x.png
# Home screen on iPad Pro
create_image '#0000ff' white 167 Icon-83.5@2x.png
# Spotlight (should be Icon-Small-40.png)
create_image '#ff00ff' white 40 Icon-40.png
# Spotlight on devices with retina display (should be Icon-Small-40@2x.png)
create_image '#ff00ff' white 80 Icon-40@2x.png
# Spotlight on devices with retina HD display (should be Icon-Small-40@3x.png)
create_image '#ff00ff' white 120 Icon-40@3x.png
# Settings (should be Icon-Small.png)
create_image '#0000ff' white 29 Icon-29.png
# Settings on devices with retina display (should be Icon-Small@2x.png)
create_image '#ff00ff' white 58 Icon-29@2x.png
# Settings on devices with retina HD display (should be Icon-Small@3x.png)
create_image '#ff0000' white 87 Icon-29@3x.png
# iPhone Notification on devices with retina display
create_image '#ff0000' white 40 Icon-20@2x.png
# Notification
create_image '#ff00ff' white 20 Icon-20.png
# Notification on devices with retina display
create_image '#ff00ff' white 40 Icon-20@2x.png
# Notification on devices with retina HD display
create_image '#ff00ff' white 60 Icon-20@3x.png
# Home screen on Apple Watch (38mm/42mm), Long-Look notification on Apple Watch (38mm) (should be AppIcon40x40@2x.png)
create_image '#00ff00' black 80 WatchAppIcon-40@2x.png
# Long-Look notification on Apple Watch (42mm) (should be AppIcon44x44@2x.png)
create_image '#00ff00' black 88 WatchAppIcon-44@2x.png
# Short-Look notification on Apple Watch (38mm) (should be AppIcon86x86@2x.png)
create_image '#00ff00' black 172 WatchAppIcon-86@2x.png
# Short-Look notification on Apple Watch (42mm) (should be AppIcon98x98@2x.png)
create_image '#00ff00' black 196 WatchAppIcon-98@2x.png
# Notification center on Apple Watch (38mm) (should be AppIcon24x24@2x.png)
create_image '#00ff00' black 48 WatchAppIcon-24@2x.png
# Notification center on Apple Watch (42mm) (should be AppIcon27.5x27.5@2x.png)
create_image '#00ff00' black 55 WatchAppIcon-27.5@2x.png
# Settings in the Apple Watch companion app on iPhone (should be AppIcon29x29@2x.png)
create_image '#00ff00' black 58 WatchAppIcon-29@2x.png
# Settings in the Apple Watch companion app on iPhone 6 Plus (should be AppIcon29x29@3x.png)
create_image '#00ff00' black 87 WatchAppIcon-29@3x.png
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment