A program that automatically resizes the iOS app icon to the required image size in Python

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.

Prerequisites

-The environment must be able to execute python programs. -Environment where Python image processing library "Pillow" can be used

Overview

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

How to use

  1. 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)

  2. Place icon.png in the same folder as iconResize.py

  3. 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

A program that automatically resizes the iOS app icon to the required image size in Python
I made a program to check the size of a file in Python
How to check the memory size of a variable in Python
How to check the memory size of a dictionary in Python
[Python] A program that rotates the contents of the list to the left
[Python] A program that rounds the score
[Python] A program that calculates the number of socks to be paired
A python program that resizes a video and turns it into an image
A program that removes duplicate statements in Python
A program that searches for the same image
A solution to the problem that the Python version in Conda cannot be changed
I want to exe and distribute a program that resizes images Python3 + pyinstaller
[Python3] Code that can be used when you want to cut out an image in a specific size
[Python] A program that counts the number of valleys
Convert the image in .zip to PDF with Python
[Python] A program that compares the positions of kangaroos.
Python OpenCV tried to display the image in text.
[Python] A program that finds the shortest number of steps in a game that crosses clouds
A note that runs an external program in Python and parses the resulting line
How to find the first element that matches your criteria in a Python list
[C / C ++] Pass the value calculated in C / C ++ to a python function to execute the process, and use that value in C / C ++.
A Python program in "A book that gently teaches difficult programming"
A general-purpose program that formats Linux command strings in python
[python] Change the image file name to a serial number
A Python script that saves a clipboard (GTK) image to a file.
How to use the __call__ method in a Python class
Change the standard output destination to a file in Python
I made a program in Python that changes the 1-minute data of FX to an arbitrary time frame (1 hour frame, etc.)
Summary of points to keep in mind when writing a program that runs on Python 2.5
[Python] Programming to find the number of a in a character string that repeats a specified number of times.
I tried "a program that removes duplicate statements in Python"
I made a program to collect images in tweets that I liked on twitter with Python
How to get the last (last) value in a list in Python
Let's create a program that automatically registers ID/PW from CSV to Bitwarden with Python + Selenium
[Python] A program that finds the most common bird types
[Python] A program to find the number of apples and oranges that can be harvested
I wrote a script that splits the image in two
[Python] Create a program to delete line breaks in the clipboard + Register as a shortcut with windows
[Python] I tried to make a simple program that works on the command line using argparse.
A story that didn't work when I tried to log in with the Python requests module
Play a sound in Python assuming that the keyboard is a piano keyboard
How to determine the existence of a selenium element in Python
I made a program that solves the spot the difference in seconds
A story that struggled to handle the Python package of PocketSphinx
Automatically resize screenshots for the App Store for each screen in Python
How to judge that the cross key is input in Python3
[Introduction to Python] How to use the in operator in a for statement?
A function that measures the processing time of a method in python
[Ev3dev] Create a program that captures the LCD (screen) using python
Read a file in Python with a relative path from the program
Try to write a program that abuses the program and sends 100 emails
A program that determines whether a number entered in Python is a prime number
A script that returns 0, 1 attached to the first Python prime number
I made a program that automatically calculates the zodiac with tkinter
[python] A note that started to understand the behavior of matplotlib.pyplot
In the python command python points to python3.8
When writing a program in Python
I tried to make a system to automatically acquire the program guide → register it in the calendar in one day
A program that automatically determines whether an animation or a photo is entered when a person's image is input [python]
A story about creating a program that will increase the number of Instagram followers from 0 to 700 in a week
[Python] A program that calculates the number of chocolate segments that meet the conditions