When developing an iOS app, I think you have to create an app icon that matches the size of your iPhone, iPad, etc. It was very troublesome to resize, so I wrote a program in Python.
-The environment must be able to execute python programs. -Environment where Python image processing library "Pillow" can be used
The image is resized and output to the following pixels that require icon settings when developing an iOS application. 20px, 29px ,40px ,58px ,60px ,76px ,80px ,87px ,120px ,152px, 167px ,180px
Rename the .png image you want to resize to icon.png (If you want to change the icon name and extension, rewrite the program icon.png)
Place icon.png in the same folder as iconResize.py
When you execute iconResize.py, the resized .png will be output in the same folder.
# iconResize.py
from PIL import Image
input_view = Image.open("icon.png ")
Size = [20,29,40,58,60,76,80,87,120,152,167,180]
for size in Size:
icon = input_view.resize((size,size))
icon.save("icon_x" + str(size) + ".png ")
It is also posted on GitHub, so you can download it and use it. https://github.com/komaki1996/iconResize
If you want to change or add the output image size, you can change and add the output size by changing the following line in iconResize.py.
Size = [20,29,40,58,60,76,80,87,120,152,167,180]
Recommended Posts