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 Icon-60@2x.png
sips -Z 180 Icon.png --out Icon-60@3x.png
sips -Z 76 Icon.png --out Icon-76@.png
sips -Z 152 Icon.png --out Icon-76@2x.png
sips -Z 167 Icon.png --out Icon-83.5@2x.png
sips -Z 29 Icon.png --out Icon-29@.png
sips -Z 58 Icon.png --out Icon-29@2x.png
sips -Z 87 Icon.png --out Icon-29@3x.png
sips -Z 40 Icon.png --out Icon-40@.png
sips -Z 80 Icon.png --out Icon-40@2x.png
sips -Z 120 Icon.png --out Icon-40@3x.png
sips -Z 20 Icon.png --out Icon-20@.png
sips -Z 40 Icon.png --out Icon-20@2x.png
sips -Z 60 Icon.png --out Icon-20@3x.png

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

cat << EOF > /path/Assets.xcassets/AppIcon.appiconset/Contents.json
{
  "images" : [
    {
      "size" : "20x20",
      "idiom" : "iphone",
      "filename" : "Icon-20@2x.png",
      "scale" : "2x"
    },
    {
      "size" : "20x20",
      "idiom" : "iphone",
      "filename" : "Icon-20@3x.png",
      "scale" : "3x"
    },
    {
      "size" : "29x29",
      "idiom" : "iphone",
      "filename" : "Icon-29@2x.png",
      "scale" : "2x"
    },
    {
      "size" : "29x29",
      "idiom" : "iphone",
      "filename" : "Icon-29@3x.png",
      "scale" : "3x"
    },
    {
      "size" : "40x40",
      "idiom" : "iphone",
      "filename" : "Icon-40@2x.png",
      "scale" : "2x"
    },
    {
      "size" : "40x40",
      "idiom" : "iphone",
      "filename" : "Icon-40@3x.png",
      "scale" : "3x"
    },
    {
      "size" : "60x60",
      "idiom" : "iphone",
      "filename" : "Icon-60@2x.png",
      "scale" : "2x"
    },
    {
      "size" : "60x60",
      "idiom" : "iphone",
      "filename" : "Icon-60@3x.png",
      "scale" : "3x"
    },
    {
      "size" : "20x20",
      "idiom" : "ipad",
      "filename" : "Icon-20@.png",
      "scale" : "1x"
    },
    {
      "size" : "20x20",
      "idiom" : "ipad",
      "filename" : "Icon-20@2x.png",
      "scale" : "2x"
    },
    {
      "size" : "29x29",
      "idiom" : "ipad",
      "filename" : "Icon-29@.png",
      "scale" : "1x"
    },
    {
      "size" : "29x29",
      "idiom" : "ipad",
      "filename" : "Icon-29@2x.png",
      "scale" : "2x"
    },
    {
      "size" : "40x40",
      "idiom" : "ipad",
      "filename" : "Icon-40@.png",
      "scale" : "1x"
    },
    {
      "size" : "40x40",
      "idiom" : "ipad",
      "filename" : "Icon-40@2x.png",
      "scale" : "2x"
    },
    {
      "size" : "76x76",
      "idiom" : "ipad",
      "filename" : "Icon-76@.png",
      "scale" : "1x"
    },
    {
      "size" : "76x76",
      "idiom" : "ipad",
      "filename" : "Icon-76@2x.png",
      "scale" : "2x"
    },
    {
      "size" : "83.5x83.5",
      "idiom" : "ipad",
      "filename" : "Icon-83.5@2x.png",
      "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?