Using Python to instantly create iOS/Android variable-size app icons
The quickest way to create icons of different sizes in different folders with different names, perfect for Cross-platform devs
Ever needed 20 multiple smaller sizes for your 1024x1024 dimension icons, but didn’t want to be dependent on a busy designer? Ever hear the designer mock you, saying that they can resize the icon faster than it will take you to open Photoshop? Or are you just fed up of seeing ads on websites that resize app icons automatically and waiting for those 20 seconds to see the “Download Now” link?
Well now you can do it all by yourself, instantly with the tap of your enter key. Here’s your path to independence:
Qualifications Required
You really don’t need to know how to code, just how to edit some text. Although there are many ways of doing this, I will walk you through the simplest one, which will basically involve a couple of clicks, scrolls & text edits.
What You Need
You can use either a Mac, PC or Linux, & if you don’t already have it, you need to install the latest version of Python, available for FREE. You will also need the big app icon that you want to resize into multiple smaller icons, and obviously you need the list of all the picture dimensions you need. And install the Python Image Library from Terminal/Command-Prompt by entering:
pip3 install python-resize-image
The Resize
The Picture
Place the picture you want to resize in a Python2
folder in your Documents.
The Code
- Create a new file in a text editor, paste the code from below and save it as
resizer.py
. - Change the username in the path from “
saamer
” to your local username. - Add more
im.resize
andimResize.save
lines depending on how many images you need. The code below will create 2 images of size 24x24 and 36x36.
The Execution
Open your Terminal/Command-Prompt to the directory where you saved the resizer.py file and run the following:
python resizer.py
The Outcome
Voila! Depending on how many images you resized, you will notice that you have created a new folder that has all the resized images that you wanted!
In case you are a more visual person, here is a quick video tutorial:
Shout out to the resizer OG “icon.angrymarmot.org” (doesn’t work anymore). You helped with generating app icons instantly when I just started mobile development, I would have been lost without you. I hope you are happy wherever you are.