Skip to content

Instantly share code, notes, and snippets.

@sugumura
Created May 16, 2017 05:42
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sugumura/03a783064858c7b89ae3324f642c0454 to your computer and use it in GitHub Desktop.
Save sugumura/03a783064858c7b89ae3324f642c0454 to your computer and use it in GitHub Desktop.
Mac OS X用のアイコンファイル(.icns)を生成するスクリプトです。icon_512x512@2x.png(解像度が1024x1024)のファイルを実行フォルダに設置して実行してください。
#!/bin/sh
# for Mac OS X
# required sips command
cd `dirname $0`
outdir="icon.iconset"
mkdir -p $outdir
if [ -e "icon_512x512@2x.png" ]; then
BASE_FILE="icon_512x512@2x.png"
else
echo "Not Found file icon_512x512@2x.png..."
exit 1
fi
sips -Z 1024 ${BASE_FILE} --out ${outdir}/icon_512x512@2x.png
sips -Z 512 ${BASE_FILE} --out ${outdir}/icon_512x512.png
sips -Z 512 ${BASE_FILE} --out ${outdir}/icon_256x256@2x.png
sips -Z 256 ${BASE_FILE} --out ${outdir}/icon_256x256.png
sips -Z 256 ${BASE_FILE} --out ${outdir}/icon_128x128@2x.png
sips -Z 128 ${BASE_FILE} --out ${outdir}/icon_128x128.png
sips -Z 64 ${BASE_FILE} --out ${outdir}/icon_32x32@2x.png
sips -Z 32 ${BASE_FILE} --out ${outdir}/icon_32x32.png
sips -Z 32 ${BASE_FILE} --out ${outdir}/icon_16x16@2x.png
sips -Z 16 ${BASE_FILE} --out ${outdir}/icon_16x16.png
iconutil -c icns ${outdir}
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment