Pillow is a fork of PIL.

Resources

  • python-pillow.org

    This is the home of Pillow, the friendly PIL fork. PIL is the Python Imaging Library. If you have ever worried or wondered about the future of PIL, please stop. Weโ€™re here to save the day.

  • python-pillow/Pillow

Installation

$ pip install --upgrade Pillow

Basic usage

From Tutorial in the Handbook.

from PIL import Image

im = Image.open("hopper.ppm")

print(im.format, im.size, im.mode)
# PPM (512, 512) RGB

Resize image

Based on AWS lab.

from PIL import Image


def resize_image(image_path, resized_path):
    with Image.open(image_path) as image:
        image.thumbnail((128, 128))
        image.save(resized_path)