Generate iOS app icons using shell script

Create shell script file make_app_icon.sh :

make_app_icon is a shell script which aim to generate iOS APP icons easier and simply.

#!/bin/sh
rm -rf /tmp/AppIcon.appiconset
mkdir /tmp/AppIcon.appiconset

sips -z 20 20 $1 --out /tmp/AppIcon.appiconset/Icon-20@1x.png
sips -z 40 40 $1 --out /tmp/AppIcon.appiconset/Icon-20@2x.png
sips -z 60 60 $1 --out /tmp/AppIcon.appiconset/Icon-20@3x.png

sips -z 29 29 $1 --out /tmp/AppIcon.appiconset/Icon-29@1x.png
sips -z 58 58 $1 --out /tmp/AppIcon.appiconset/Icon-29@2x.png
sips -z 87 87 $1 --out /tmp/AppIcon.appiconset/Icon-29@3x.png

sips -z 40 40 $1 --out /tmp/AppIcon.appiconset/Icon-40@1x.png
sips -z 80 80 $1 --out /tmp/AppIcon.appiconset/Icon-40@2x.png
sips -z 120 120 $1 --out /tmp/AppIcon.appiconset/Icon-40@3x.png

sips -z 57 57 $1 --out /tmp/AppIcon.appiconset/Icon-57@1x.png
sips -z 114 114 $1 --out /tmp/AppIcon.appiconset/Icon-57@2x.png

sips -z 120 120 $1 --out /tmp/AppIcon.appiconset/Icon-60@2x.png
sips -z 180 180 $1 --out /tmp/AppIcon.appiconset/Icon-60@3x.png

sips -z 72 72 $1 --out /tmp/AppIcon.appiconset/Icon-72@1x.png
sips -z 144 144 $1 --out /tmp/AppIcon.appiconset/Icon-72@2x.png

sips -z 76 76 $1 --out /tmp/AppIcon.appiconset/Icon-76@1x.png
sips -z 152 152 $1 --out /tmp/AppIcon.appiconset/Icon-76@2x.png

sips -z 50 50 $1 --out /tmp/AppIcon.appiconset/Icon-50@1x.png
sips -z 100 100 $1 --out /tmp/AppIcon.appiconset/Icon-50@2x.png

sips -z 167 167 $1 --out /tmp/AppIcon.appiconset/Icon-83.5@2x.png

sips -z 1024 1024 $1 --out /tmp/AppIcon.appiconset/Icon-1024.png

cat <<EOT >> /tmp/AppIcon.appiconset/Contents.json
{
    "images":[
        {
            "idiom":"iphone",
            "size":"20x20",
            "scale":"2x",
            "filename":"Icon-20@2x.png"
        },
        {
            "idiom":"iphone",
            "size":"20x20",
            "scale":"3x",
            "filename":"Icon-20@3x.png"
        },
        {
            "idiom":"iphone",
            "size":"29x29",
            "scale":"1x",
            "filename":"Icon-29@1x.png"
        },
        {
            "idiom":"iphone",
            "size":"29x29",
            "scale":"2x",
            "filename":"Icon-29@2x.png"
        },
        {
            "idiom":"iphone",
            "size":"29x29",
            "scale":"3x",
            "filename":"Icon-29@3x.png"
        },
        {
            "idiom":"iphone",
            "size":"40x40",
            "scale":"2x",
            "filename":"Icon-40@2x.png"
        },
        {
            "idiom":"iphone",
            "size":"40x40",
            "scale":"3x",
            "filename":"Icon-40@3x.png"
        },
        {
            "idiom":"iphone",
            "size":"57x57",
            "scale":"1x",
            "filename":"Icon-57@1x.png"
        },
        {
            "idiom":"iphone",
            "size":"57x57",
            "scale":"2x",
            "filename":"Icon-57@2x.png"
        },
        {
            "idiom":"iphone",
            "size":"60x60",
            "scale":"2x",
            "filename":"Icon-60@2x.png"
        },
        {
            "idiom":"iphone",
            "size":"60x60",
            "scale":"3x",
            "filename":"Icon-60@3x.png"
        },
        {
            "idiom":"ipad",
            "size":"20x20",
            "scale":"1x",
            "filename":"Icon-20@1x.png"
        },
        {
            "idiom":"ipad",
            "size":"20x20",
            "scale":"2x",
            "filename":"Icon-20@2x.png"
        },
        {
            "idiom":"ipad",
            "size":"29x29",
            "scale":"1x",
            "filename":"Icon-29@1x.png"
        },
        {
            "idiom":"ipad",
            "size":"29x29",
            "scale":"2x",
            "filename":"Icon-29@2x.png"
        },
        {
            "idiom":"ipad",
            "size":"40x40",
            "scale":"1x",
            "filename":"Icon-40@1x.png"
        },
        {
            "idiom":"ipad",
            "size":"40x40",
            "scale":"2x",
            "filename":"Icon-40@2x.png"
        },
        {
          "size" : "50x50",
          "idiom" : "ipad",
          "filename" : "Icon-50@1x.png",
          "scale" : "1x"
        },
        {
          "size" : "50x50",
          "idiom" : "ipad",
          "filename" : "Icon-50@2x.png",
          "scale" : "2x"
        },
        {
            "idiom":"ipad",
            "size":"72x72",
            "scale":"1x",
            "filename":"Icon-72@1x.png"
        },
        {
            "idiom":"ipad",
            "size":"72x72",
            "scale":"2x",
            "filename":"Icon-72@2x.png"
        },
        {
            "idiom":"ipad",
            "size":"76x76",
            "scale":"1x",
            "filename":"Icon-76@1x.png"
        },
        {
            "idiom":"ipad",
            "size":"76x76",
            "scale":"2x",
            "filename":"Icon-76@2x.png"
        },
        {
            "idiom":"ipad",
            "size":"83.5x83.5",
            "scale":"2x",
            "filename":"Icon-83.5@2x.png"
        },
        {
          "idiom" : "ios-marketing",
          "scale" : "1x",
          "size" : "1024x1024",
          "filename":"Icon-1024.png"
        }
    ],
    "info":{
        "version":1,
        "author":"vinhvd"
    }
}
EOTCode language: JavaScript (javascript)

Make make_app_icon executable:

chmod +x /tmp/make_app_icon.sh

Generate iOS App Icon:

/tmp/make_app_icon.sh '~/Downloads/AppIcon.png'

Your appiconset will appear here: /tmp/AppIcon.appiconset

vinhvd

Hello there! 👋 I'm Vinh.