Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save bryfox/8c48a4eda41136e851e7a4ac541c7632 to your computer and use it in GitHub Desktop.
Save bryfox/8c48a4eda41136e851e7a4ac541c7632 to your computer and use it in GitHub Desktop.
#!/bin/bash
# usage :
# generate-iOS-app-icons.sh someDir/sourceImage-1024x1024.png path/where/ImagesAssets/is/located
mkdir -p generated
# you'll have to delete this one after executing the script if you copy the generated images in the Images asset
SOURCE_ICON="$1"
PATH_TO_IMAGES_ASSET="$2"
listOfSizes="29 58 80 57 114 120 180 40 50 100 72 144 76 152"
for imageSize in $listOfSizes
do
sips -Z ${imageSize} --out generated/icon${imageSize}.png "${SOURCE_ICON}"
done
cp generated/*.png "${PATH_TO_IMAGES_ASSET}/Images.xcassets/AppIcon.appiconset"
# you'll have to modify the content.json or do it in XCode...
############# For reference, below the original gist content, which size applies to what :
#sips -Z 29 --out generated/iPhoneSettings-29x29.png ${SOURCE_ICON}
#sips -Z 58 --out generated/iPhoneSettings-29x29@2x.png ${SOURCE_ICON}
#sips -Z 80 --out generated/iPhoneSpotlight-40x40@2x.png ${SOURCE_ICON}
#sips -Z 57 --out generated/iPhoneIOS6App-57x57.png ${SOURCE_ICON}
#sips -Z 114 --out generated/iPhoneIOS6App-57x57@2x.png ${SOURCE_ICON}
#sips -Z 120 --out generated/iPhoneApp-60x60@2x.png ${SOURCE_ICON}
#sips -Z 180 --out generated/iPhoneApp-60x60@2x.png ${SOURCE_ICON}
#sips -Z 29 --out generated/iPadSettings-29x29.png ${SOURCE_ICON}
#sips -Z 58 --out generated/iPadSettings-29x29@2x.png ${SOURCE_ICON}
#sips -Z 40 --out generated/iPadSpotlight-40x40.png ${SOURCE_ICON}
#sips -Z 80 --out generated/iPadSpotlight-40x40@2x.png ${SOURCE_ICON}
#sips -Z 50 --out generated/iPadSpotlightIOS6-50x50.png ${SOURCE_ICON}
#sips -Z 100 --out generated/iPadSpotlightIOS6-50x50@2x.png ${SOURCE_ICON}
#sips -Z 72 --out generated/iPadAppIOS6-72x72.png ${SOURCE_ICON}
#sips -Z 144 --out generated/iPadAppIOS6-72x72@2x.png ${SOURCE_ICON}
#sips -Z 76 --out generated/iPadApp-76x76.png ${SOURCE_ICON}
#sips -Z 152 --out generated/iPadApp-76x76@2x.png ${SOURCE_ICON}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment