Pillow is a fork of PIL (Python Imaging Library) which works on Python 3. It provides convenient methods to manipulate and convert image files with just a few lines of code. Usually every mobile application platform requires the same image to be provided in multiple sizes, and since resizing these images manually can be cumbersome, Pillow and Python can come to save the day by automating these processes.

from PIL import Image
inputName = "image.png"
sizes = (512, 256, 128, 64, 32)
img = Image.open(inputName)
for size in sizes:
    name = "{}-{}.png".format(inputName, size)
    resizedImage = img.resize((size, size), Image.ANTIALIAS)

To install Pillow using pip, you can simply execute:

pip install Pillow