Set iOS icon in xcode, Images.xcassets/AppIcon.appiconset

0

It was difficult to understand the icon setting in xcode, so I will write the method.

Place the .png in the Images.xcassets/AppIcon.appiconset/ of the project. Then write a Contents.json.

With icon_1024x1024.png in the Images.xcassets/AppIcon.appiconset/ and running the script below, you will create an icon in imagamagick.

icon.zsh
#!/bin/zsh

# Images.xcassets/AppIcon.appiconset/
# use : icon_1024x1024.png

mogrify -resize 20x20! icon_1024x1024.png icon-20.png
mogrify -resize 40x40! icon_1024x1024.png [email protected]
mogrify -resize 60x60! icon_1024x1024.png [email protected]
mogrify -resize 80x80! icon_1024x1024.png [email protected]
mogrify -resize 120x120! icon_1024x1024.png [email protected]
mogrify -resize 180x180! icon_1024x1024.png [email protected]

cp -rf [email protected] icon-40.png
cp -rf [email protected] icon-60.png
cp -rf [email protected] [email protected]

mogrify -resize 29x29! icon_1024x1024.png icon-29.png
mogrify -resize 58x58! icon_1024x1024.png [email protected]
mogrify -resize 87x87! icon_1024x1024.png [email protected]
mogrify -resize 76x76! icon_1024x1024.png icon-76.png
mogrify -resize 152x152! icon_1024x1024.png [email protected]
mogrify -resize 167x167! icon_1024x1024.png [email protected]

if [ ! -f ./Contents.json ];then
echo '
{
  "images" : [
    {
      "filename" : "[email protected]",
      "idiom" : "iphone",
      "scale" : "2x",
      "size" : "20x20"
    },
    {
      "filename" : "[email protected]",
      "idiom" : "iphone",
      "scale" : "3x",
      "size" : "20x20"
    },
    {
      "filename" : "[email protected]",
      "idiom" : "iphone",
      "scale" : "2x",
      "size" : "29x29"
    },
    {
      "filename" : "[email protected]",
      "idiom" : "iphone",
      "scale" : "3x",
      "size" : "29x29"
    },
    {
      "filename" : "[email protected]",
      "idiom" : "iphone",
      "scale" : "2x",
      "size" : "40x40"
    },
    {
      "filename" : "[email protected]",
      "idiom" : "iphone",
      "scale" : "3x",
      "size" : "40x40"
    },
    {
      "filename" : "[email protected]",
      "idiom" : "iphone",
      "scale" : "2x",
      "size" : "60x60"
    },
    {
      "filename" : "[email protected]",
      "idiom" : "iphone",
      "scale" : "3x",
      "size" : "60x60"
    },
    {
      "filename" : "icon-20.png",
      "idiom" : "ipad",
      "scale" : "1x",
      "size" : "20x20"
    },
    {
      "filename" : "[email protected]",
      "idiom" : "ipad",
      "scale" : "2x",
      "size" : "20x20"
    },
    {
      "filename" : "icon-29.png",
      "idiom" : "ipad",
      "scale" : "1x",
      "size" : "29x29"
    },
    {
      "filename" : "[email protected]",
      "idiom" : "ipad",
      "scale" : "2x",
      "size" : "29x29"
    },
    {
      "filename" : "icon-40.png",
      "idiom" : "ipad",
      "scale" : "1x",
      "size" : "40x40"
    },
    {
      "filename" : "[email protected]",
      "idiom" : "ipad",
      "scale" : "2x",
      "size" : "40x40"
    },
    {
      "filename" : "icon-76.png",
      "idiom" : "ipad",
      "scale" : "1x",
      "size" : "76x76"
    },
    {
      "filename" : "[email protected]",
      "idiom" : "ipad",
      "scale" : "2x",
      "size" : "76x76"
    },
    {
      "filename" : "[email protected]",
      "idiom" : "ipad",
      "scale" : "2x",
      "size" : "83.5x83.5"
    },
    {
      "filename" : "icon_1024x1024.png",
      "idiom" : "ios-marketing",
      "scale" : "1x",
      "size" : "1024x1024"
    }
  ],
  "info" : {
    "author" : "xcode",
    "version" : 1
  }
}' > ./Contents.json
fi
Share:
0
syui
Author by

syui

Updated on May 25, 2020