28
27

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

iOSアプリケーションアイコンの設定手順

Last updated at Posted at 2017-02-19

あまり更新頻度は高くないためxCodeでポチポチ設定することも可能ですが、
CLIから行うための手順をメモ。

1. Icon.pngを用意する

お好みのツールで基準とするアイコンファイルを作成する。

2. Application用の各サイズの画像ファイルを生成する

MacOSX固有コマンドsipsを利用してファイルのリサイズを行う。
/path/ はプロジェクトのパスに応じて適宜置き換えて下さい)

cp -p icon.png /path/Assets.xcassets/AppIcon.appiconset
cd /path/Assets.xcassets/AppIcon.appiconset

sips -Z 120 Icon.png --out [email protected]
sips -Z 180 Icon.png --out [email protected]
sips -Z 76 Icon.png --out [email protected]
sips -Z 152 Icon.png --out [email protected]
sips -Z 167 Icon.png --out [email protected]
sips -Z 29 Icon.png --out [email protected]
sips -Z 58 Icon.png --out [email protected]
sips -Z 87 Icon.png --out [email protected]
sips -Z 40 Icon.png --out [email protected]
sips -Z 80 Icon.png --out [email protected]
sips -Z 120 Icon.png --out [email protected]
sips -Z 20 Icon.png --out [email protected]
sips -Z 40 Icon.png --out [email protected]
sips -Z 60 Icon.png --out [email protected]

3. Application用のAsset設定ファイルを更新する

cat << EOF > /path/Assets.xcassets/AppIcon.appiconset/Contents.json
{
  "images" : [
    {
      "size" : "20x20",
      "idiom" : "iphone",
      "filename" : "[email protected]",
      "scale" : "2x"
    },
    {
      "size" : "20x20",
      "idiom" : "iphone",
      "filename" : "[email protected]",
      "scale" : "3x"
    },
    {
      "size" : "29x29",
      "idiom" : "iphone",
      "filename" : "[email protected]",
      "scale" : "2x"
    },
    {
      "size" : "29x29",
      "idiom" : "iphone",
      "filename" : "[email protected]",
      "scale" : "3x"
    },
    {
      "size" : "40x40",
      "idiom" : "iphone",
      "filename" : "[email protected]",
      "scale" : "2x"
    },
    {
      "size" : "40x40",
      "idiom" : "iphone",
      "filename" : "[email protected]",
      "scale" : "3x"
    },
    {
      "size" : "60x60",
      "idiom" : "iphone",
      "filename" : "[email protected]",
      "scale" : "2x"
    },
    {
      "size" : "60x60",
      "idiom" : "iphone",
      "filename" : "[email protected]",
      "scale" : "3x"
    },
    {
      "size" : "20x20",
      "idiom" : "ipad",
      "filename" : "[email protected]",
      "scale" : "1x"
    },
    {
      "size" : "20x20",
      "idiom" : "ipad",
      "filename" : "[email protected]",
      "scale" : "2x"
    },
    {
      "size" : "29x29",
      "idiom" : "ipad",
      "filename" : "[email protected]",
      "scale" : "1x"
    },
    {
      "size" : "29x29",
      "idiom" : "ipad",
      "filename" : "[email protected]",
      "scale" : "2x"
    },
    {
      "size" : "40x40",
      "idiom" : "ipad",
      "filename" : "[email protected]",
      "scale" : "1x"
    },
    {
      "size" : "40x40",
      "idiom" : "ipad",
      "filename" : "[email protected]",
      "scale" : "2x"
    },
    {
      "size" : "76x76",
      "idiom" : "ipad",
      "filename" : "[email protected]",
      "scale" : "1x"
    },
    {
      "size" : "76x76",
      "idiom" : "ipad",
      "filename" : "[email protected]",
      "scale" : "2x"
    },
    {
      "size" : "83.5x83.5",
      "idiom" : "ipad",
      "filename" : "[email protected]",
      "scale" : "2x"
    }
  ],
  "info" : {
    "version" : 1,
    "author" : "xcode"
  }
}
EOF

以上。

28
27
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
28
27

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?