Since the last year I’ve been doing more and more iOS development and found last week that this thing with icons and sizes can be a tiersome timesink so I wrapped up two small scripts to shave off some time. The first one is one to generate AppStore icons from the original 1024x1024 image and all the sizes I need for a universial app.

  #!/bin/bash
  fileName=$(echo $1 |cut -f 1 -d .)

  sizes=( 180 167 152 120 76 )

  for size in "${sizes[@]}"
  do
  	convert $1 -resize $size'x'$size $fileName-$size.png
  done

Just copy and pastet the script above into a file, make it executable and run it. I think you could optimize it by giving ImageMagick more parameters for scaling quality but so far I haven’t seen any visual degrading so far, but use it at your own risk.

The second script is just a simple one to create two images in 1x and 2x sizes. I’ve use this for some icons that I get in the 3x size and need to scale down to 1x and 2x sizes. This script scales down the original image into a 67% size and 33% size for the images and sizes I have tested this creates the best 1x and 2x sizes.

  #!/bin/bash
  fileName=$(echo $1 |cut -f 1 -d .)

  convert -resize 67% $1 $fileName-@2x.png
  convert -resize 33% $1 $fileName-@1x.png

This has already save me some time and hopefully someone else might have some use of these scripts as well.