Skip to content

Instantly share code, notes, and snippets.

@csfelipe
Created November 26, 2015 12:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save csfelipe/4bf2bfab99d624b7e635 to your computer and use it in GitHub Desktop.
Save csfelipe/4bf2bfab99d624b7e635 to your computer and use it in GitHub Desktop.
Gets a "source" icon file and creates new one with the specific name and dimensions

GIiPhoneIconGenerator

This script helps you handle the painful process of creating all those app icon variations for your project assets in Xcode.

Step 1: After downloading this baby put it into the folder where the app icon is Step 2: Rename your app icon to "icon.png" Step 3: Open you Terminal and navigate to where the script is and do ./GIiPhoneIconGenerator.sh Step 4: Take a sip of that sweet hot chocolat. Cheers!

Customizations

  1. Change icon names: just got the to the "# icon names" section and put in the names you'd like to use
  2. Change icon sizes: just got the to the "# icon sizes" section and put in the sizes you'd like to use
# icon names
icon_names=("icon-29@1x.png" "icon-29@2x.png" "icon-29@3x.png" "icon-40@1x.png" "icon-40@2x.png" "icon-40@3x.png" "icon-60@1x.png" "icon-60@2x.png" "icon-60@3x.png")
# icon sizes
icon_size=(29 58 87 40 80 120 60 120 180)
directory_path="$PWD"
source_file="$directory_path/icon.png"
incomplete_command="cp $source_file $directory_path/"
#echo $directory_path
#echo $source_file
for (( i = 0 ; i < ${#icon_names[@]} ; i++ ))
do
copy_command="$incomplete_command${icon_names[$i]}"
echo $copy_command
$copy_command
rescale_command="sips -Z ${icon_size[$i]} ${icon_names[$i]}"
echo $rescale_command
$rescale_command
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment