Skip to main content

Generate app icons using bash script in Windows

Generating an app's icon in all necessary sizes for both Android and iOS can be really time consuming and boring. It would be ok to do this work manually if you'd only have to do it once for each app just before release. Unfortunately that's not the case since the final app icon is most likely something that evolves through iteration. Needless to say, there is time to save by finding an efficient way to automate the icon generation.

There are many tools out there that can help out with this. I've tried a couple of them and they've all worked just fine. The problem is that I've found that they don't actually save me that much time in the end.

For iOS, you need a completely square icon and iTunes/iOS will handle the rounding of the corners for you. For Android on the other hand, you have complete freedom when designing the shape of your icon. I prefer to have my Android icon look as similar to the iOS icon as possible, which means that I'll have to create an icon with prerounded corners before I generate the thumbnails. Using an online tool means that I'll have to upload each of these icons separately, and then manually sort through the resulting thumbnails to find my iOS/Android icons. The process also includes renaming many of the resulting thumbnails to match the names I've specified in my config files. That's still quite a lot of very tedious and error-prone work.

Because of this I decided to write a simple little bash script to generate the icons, using a couple of command line tools to resize the images and reduce file sizes.

The tools used by the script are:

  • ImageMagick - Great tool for image manipulation. I use it only for resizing in this script. Can be downloaded for free at http://www.imagemagick.org.
  • pngquant - Reduces file size for png images. I use this for all my images in my apps, not only the icons. Haven't noticed any difference in image quality when using it,  but file size is often down to ~30%. Downloaded for free at https://pngquant.org.

Two icon images are also required by the script, one for iOS and one for Android. They should both be sized 1024x1024 pixels and be placed in the same folder as the script.
  • icon-template-ios.png
  • icon-template-android.png
As mentioned, I prefer to have the icons look identical for Android and iOS, so my two icon files for Ice Trap would look like this:

iOS icon template - Must be square, rounding will be handled by iTunes and iOS
Android icon template - Trying to mimic the iOS rounding


The filenames generated by the script are adapted for Corona SDK, as listed here. If you prefer other filenames, just edit the script.

When everything's installed and setup, run the script from the command line and the following directories should be generated:
  • ios - iOS icons
  • android - Android icons
  • itunes -Large icon for iTunes
  • google-play - Large icon for Google Play

Finally, just copy the files to wherever you need the icons. I've chosen not to include the copying in the script, but you could easily add that if you want to. Here's the actual script. It has only been tested on Windows 10.

Comments