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

The First Prototype
2 min readJul 3, 2019

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

  1. Create a new file in a text editor, paste the code from below and save it as resizer.py.
  2. Change the username in the path from “saamer” to your local username.
  3. Add more im.resize and imResize.save lines depending on how many images you need. The code below will create 2 images of size 24x24 and 36x36.
Copy the code from here

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!

5 Icons of the correct size, created in the new folder

In case you are a more visual person, here is a quick video tutorial:

Video explaining how to do all this

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.

--

--

The First Prototype
The First Prototype

Written by The First Prototype

Developers building things, on here to share knowledge. Featured blog for PlanetXamarin.com github.com/saamerm linkedin.com/in/saamer

No responses yet