Created
April 30, 2017 16:44
-
-
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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