Python Pillow: Resize an Image Using Image.resize() – A Step Guide

In this tutorial, we will use an example to show python pillow beginners on how to resize an image.

Python Pillow - Resize an Image Using Image.resize() - A Step Guide

1.Open an image to resize

from PIL import Image

#read the image
im = Image.open("sample-image.png")

2.Use Image.resize() to resize an image

#image size
size=(200,200)
#resize image
out = im.resize(size)

3.Save resized image

#save resized image
out.save('resize-output.png')

Run this code, you will get this resized image:

Python Pillow - Resize an Image Using Image.resize()