Macで1枚のPNG画像からデスクトップアプリ用アイコンを生成するスクリプト

requirements

  1. 1024x1024のPNGを用意
  2. ImageMagickを入れる brew install imagemagick

iconutilは元々あったもの。

~ $ which iconutil /usr/bin/iconutil

script body

Bash
#!/bin/bash src=original.png dst=./app.iconset convert $src -resize 16x16 $dst/icon_16x16.png convert $src -resize 32x32 $dst/icon_32x32.png convert $src -resize 64x64 $dst/icon_64x64.png convert $src -resize 128x128 $dst/icon_128x128.png convert $src -resize 256x256 $dst/icon_256x256.png convert $src -resize 512x512 $dst/icon_512x512.png convert $src -resize 1024x1024 $dst/icon_1024x1024.png convert $src -resize 64x64 $dst/[email protected] convert $src -resize 128x128 $dst/[email protected] convert $src -resize 256x256 $dst/[email protected] convert $src -resize 512x512 $dst/[email protected] convert $src -resize 1024x1024 $dst/[email protected] iconutil -c icns app.iconset