Skip to content

Instantly share code, notes, and snippets.

@ty0x2333
Last active June 19, 2018 05:39
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ty0x2333/85b42c2be7eb72e08ac8 to your computer and use it in GitHub Desktop.
Save ty0x2333/85b42c2be7eb72e08ac8 to your computer and use it in GitHub Desktop.
generate ios / mac app icons
#!/bin/sh
SRC_FILE=$1
DST_PATH=$2
if [ -z "$DST_PATH" ]; then
DST_PATH=$(dirname $0)
fi
error() {
local red="\033[1;31m"
local normal="\033[0m"
echo "[${red}ERROR${normal}] $1"
}
# Check ImageMagick
command -v convert >/dev/null 2>&1 || { error >&2 "The ImageMagick is not installed. Please install it first.see http://www.imagemagick.org/"; exit -1; }
if [ -z $SRC_FILE ]
then
echo "No argument given"
else
convert "$SRC_FILE" -resize 29x29 "$DST_PATH/Icon-Small.png"
convert "$SRC_FILE" -resize 40x40 "$DST_PATH/Icon-Small-40.png"
convert "$SRC_FILE" -resize 50x50 "$DST_PATH/Icon-Small-50.png"
convert "$SRC_FILE" -resize 57x57 "$DST_PATH/Icon.png"
convert "$SRC_FILE" -resize 58x58 "$DST_PATH/Icon-Small@2x.png"
# convert "$SRC_FILE" -resize 60x60 "$DST_PATH/Icon-60.png"
convert "$SRC_FILE" -resize 72x72 "$DST_PATH/Icon-72.png"
convert "$SRC_FILE" -resize 76x76 "$DST_PATH/Icon-76.png"
convert "$SRC_FILE" -resize 80x80 "$DST_PATH/Icon-Small-40@2x.png"
convert "$SRC_FILE" -resize 100x100 "$DST_PATH/Icon-Small-50@2x.png"
convert "$SRC_FILE" -resize 114x114 "$DST_PATH/Icon@2x.png"
convert "$SRC_FILE" -resize 120x120 "$DST_PATH/Icon-60@2x.png"
convert "$SRC_FILE" -resize 144x144 "$DST_PATH/Icon-72@2x.png"
convert "$SRC_FILE" -resize 152x152 "$DST_PATH/Icon-76@2x.png"
convert "$SRC_FILE" -resize 180x180 "$DST_PATH/Icon-60@3x.png"
convert "$SRC_FILE" -resize 512x512 "$DST_PATH/iTunesArtwork"
convert "$SRC_FILE" -resize 1024x1024 "$DST_PATH/iTunesArtwork@2x"
fi
#!/bin/sh
SRC_FILE=$1
DST_PATH=$2
if [ -z "$DST_PATH" ]; then
DST_PATH=$(dirname $0)
fi
error() {
local red="\033[1;31m"
local normal="\033[0m"
echo "[${red}ERROR${normal}] $1"
}
# Check ImageMagick
command -v convert >/dev/null 2>&1 || { error >&2 "The ImageMagick is not installed. Please install it first.see http://www.imagemagick.org/"; exit -1; }
if [ -z $SRC_FILE ]
then
echo "No argument given"
else
convert "$SRC_FILE" -resize 16x16 "$DST_PATH/Icon-16.png"
convert "$SRC_FILE" -resize 32x32 "$DST_PATH/Icon-16@2x.png"
convert "$SRC_FILE" -resize 32x32 "$DST_PATH/Icon-32.png"
convert "$SRC_FILE" -resize 64x64 "$DST_PATH/Icon-32@2x.png"
convert "$SRC_FILE" -resize 128x128 "$DST_PATH/Icon-128.png"
convert "$SRC_FILE" -resize 256x256 "$DST_PATH/Icon-128@2x.png"
convert "$SRC_FILE" -resize 256x256 "$DST_PATH/Icon-256.png"
convert "$SRC_FILE" -resize 512x512 "$DST_PATH/Icon-256@2x.png"
convert "$SRC_FILE" -resize 512x512 "$DST_PATH/Icon-512.png"
convert "$SRC_FILE" -resize 1024x1024 "$DST_PATH/Icon-512@2x.png"
fi
@ty0x2333
Copy link
Author

ty0x2333 commented Jun 30, 2016

Usage

./generate_ios_icons.sh source/app_icon.png target

or

./generate_mac_icons.sh source/app_icon.png target

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment