Skip to content

Instantly share code, notes, and snippets.

@AndyIbanez
Created April 30, 2017 16:44
Show Gist options
  • Save AndyIbanez/7715e6849adaa8d27e0207d585dde139 to your computer and use it in GitHub Desktop.
Save AndyIbanez/7715e6849adaa8d27e0207d585dde139 to your computer and use it in GitHub Desktop.
Command line script to resize an iOS app icon to all the sizes specified by Apple.
#!/bin/bash
# Takes a 1024x1024 app icon and produces all app icon sizes based on it.
# Requires imagemagick to work.
# USAGE iair ORIGINAL_FILE PATH_TO_OUTPUT_DIR
# Example: iair icon.png .
original_file=$1
output_dir=$2
if [ ! -f $original_file ]; then
echo 'File $original_file not found'
exit
fi
#Array of all required sizes
declare -a sizes=("16"
"29"
"32"
"40"
"48"
"50"
"55"
"57"
"58"
"64"
"72"
"76"
"80"
"87"
"88"
"100"
"114"
"120"
"128"
"144"
"152"
"167"
"172"
"180"
"196"
"256"
"512"
"1024")
for size in ${sizes[@]}
do
convert $original_file -resize $size'x'$size "$output_dir/Icon-$size.png"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment