I wrote a post a while back about using Image magick and a bash script to quickly to create the various size app icon images you need for your mobile app. This is just an updated version of that post.
Automated build of Icon/Loading Files (originally posted 3/24/2012)
Because of the number of different icons needed for mobile apps I needed a quick method to input a master image and then convert the multiple images for Android and iOS. Ideally I would like something that runs from the command line so I don’t have to open any software apps that will bog down my system. As much as I looked, I could not find a quick, cost effective (read that as free), software independent, OS independent, method for resizing icon/loading files.
I realize that there are Automaters on my Mac, there are batch scripts in Photoshop and Fireworks, even a really cool Mac app called iConify(iOS only) but none of those methods meet all my requirements. I decided to use ImageMagick as my image conversion tool. Let me give you a few reasons for my choice.
- ImageMagick is open source
- Runs on UNIX, Mac OS X, Windows, iOS
- Has command Line processing
After choosing my tool, I set out to make this process as automated as possible. I am a Mac user, so I wrote a bash script to handle the workload. The bash script will organize my projects, move them around to my local storage, push to Git Hub, and now to build images for my project.
Here is how it works:
convert -geometry 114×114 -quality 100 appicon.png resources/android/appicon.png
This command executes the ImageMagick command CONVERT which takes a file called appicon.png (I have this sized at 512 x 512), resizes it to 114×114 and outputs it to my android folder with the name appicon.png at 100 percent of the quality of the original image.
I repeat this for each of my file sizes (check out my other post for more of the sizes) needed and we are done. I just keep adding to this script for other images.
Hope this speeds your image building process.
Here is my full script:
Greg Mccormick is Founder of CRUSHMEDIA.NET, a full service mobile development company located in Manhattan.