Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save doppelganger9/9a0e04e5aa28a529ebba to your computer and use it in GitHub Desktop.

Select an option

Save doppelganger9/9a0e04e5aa28a529ebba to your computer and use it in GitHub Desktop.

Revisions

  1. doppelganger9 revised this gist Oct 6, 2014. 1 changed file with 38 additions and 20 deletions.
    58 changes: 38 additions & 20 deletions generate-iOS-app-icons.sh
    Original file line number Diff line number Diff line change
    @@ -1,23 +1,41 @@
    #!/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

    sips -Z 29 --out generated/iPhoneSettings-29x29.png sourceIcon.png
    sips -Z 58 --out generated/iPhoneSettings-29x29@2x.png sourceIcon.png
    sips -Z 80 --out generated/iPhoneSpotlight-40x40@2x.png sourceIcon.png
    sips -Z 120 --out generated/iPhoneApp-60x60@2x.png sourceIcon.png

    sips -Z 57 --out generated/iPhoneIOS6App-57x57.png sourceIcon.png
    sips -Z 114 --out generated/iPhoneIOS6App-57x57@2x.png sourceIcon.png
    sips -Z 50 --out generated/iPadSpotlightIOS6-50x50.png sourceIcon.png
    sips -Z 100 --out generated/iPadSpotlightIOS6-50x50@2x.png sourceIcon.png
    sips -Z 72 --out generated/iPadAppIOS6-72x72.png sourceIcon.png
    sips -Z 144 --out generated/iPadAppIOS6-72x72@2x.png sourceIcon.png

    sips -Z 29 --out generated/iPadSettings-29x29.png sourceIcon.png
    sips -Z 58 --out generated/iPadSettings-29x29@2x.png sourceIcon.png
    sips -Z 40 --out generated/iPadSpotlight-40x40.png sourceIcon.png
    sips -Z 80 --out generated/iPadSpotlight-40x40@2x.png sourceIcon.png
    sips -Z 76 --out generated/iPadApp-76x76.png sourceIcon.png
    sips -Z 152 --out generated/iPadApp-76x76@2x.png sourceIcon.png

    #cp generated/*.png path/to/Images.xcassets/AppIcon.appiconset
    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}
  2. doppelganger9 revised this gist Oct 6, 2014. 1 changed file with 12 additions and 4 deletions.
    16 changes: 12 additions & 4 deletions generate-iOS-app-icons.sh
    Original file line number Diff line number Diff line change
    @@ -1,15 +1,23 @@
    #!/bin/bash
    mkdir -p generated

    sips -Z 29 --out generated/iPhoneSettings-29x29.png sourceIcon.png
    sips -Z 58 --out generated/iPhoneSettings-29x29@2x.png sourceIcon.png
    sips -Z 80 --out generated/iPhoneSpotlight-40x40@2x.png sourceIcon.png
    sips -Z 120 --out generated/iPhoneApp-60x60@2x.png sourceIcon.png


    sips -Z 57 --out generated/iPhoneIOS6App-57x57.png sourceIcon.png
    sips -Z 114 --out generated/iPhoneIOS6App-57x57@2x.png sourceIcon.png
    sips -Z 50 --out generated/iPadSpotlightIOS6-50x50.png sourceIcon.png
    sips -Z 100 --out generated/iPadSpotlightIOS6-50x50@2x.png sourceIcon.png
    sips -Z 72 --out generated/iPadAppIOS6-72x72.png sourceIcon.png
    sips -Z 144 --out generated/iPadAppIOS6-72x72@2x.png sourceIcon.png

    sips -Z 29 --out generated/iPadSettings-29x29.png sourceIcon.png
    sips -Z 58 --out generated/iPadSettings-29x29@2x.png sourceIcon.png
    sips -Z 40 --out generated/iPadSpotlight-40x40.png sourceIcon.png
    sips -Z 80 --out generated/iPadSpotlight-40x40@2x.png sourceIcon.png
    sips -Z 76 --out generated/iPadApp-76x76.png sourceIcon.png
    sips -Z 152 --out generated/iPadApp-76x76@2x.png sourceIcon.png

    #cp generated/*.png path/to/Images.xcassets/AppIcon.appiconset
    #cp generated/*.png path/to/Images.xcassets/AppIcon.appiconset
  3. @marcuswestin marcuswestin created this gist Oct 9, 2013.
    15 changes: 15 additions & 0 deletions generate-iOS-app-icons.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,15 @@
    mkdir -p generated

    sips -Z 29 --out generated/iPhoneSettings-29x29.png sourceIcon.png
    sips -Z 58 --out generated/iPhoneSettings-29x29@2x.png sourceIcon.png
    sips -Z 80 --out generated/iPhoneSpotlight-40x40@2x.png sourceIcon.png
    sips -Z 120 --out generated/iPhoneApp-60x60@2x.png sourceIcon.png

    sips -Z 29 --out generated/iPadSettings-29x29.png sourceIcon.png
    sips -Z 58 --out generated/iPadSettings-29x29@2x.png sourceIcon.png
    sips -Z 40 --out generated/iPadSpotlight-40x40.png sourceIcon.png
    sips -Z 80 --out generated/iPadSpotlight-40x40@2x.png sourceIcon.png
    sips -Z 76 --out generated/iPadApp-76x76.png sourceIcon.png
    sips -Z 152 --out generated/iPadApp-76x76@2x.png sourceIcon.png

    #cp generated/*.png path/to/Images.xcassets/AppIcon.appiconset