Python PIL | Image.thumbnail() Method
PIL is the Python Imaging Library which provides the python interpreter with image editing capabilities. The
Image module provides a class with the same name which is used to represent a PIL image. The module also provides a number of factory functions, including functions to load images from files, and to create new images.
Image.thumbnail() Make this image into a thumbnail. This method modifies the image to contain a thumbnail version of itself, no larger than the given size. This method calculates an appropriate thumbnail size to preserve the aspect of the image, calls the
draft() method to configure the file reader (where applicable), and finally resizes the image.
Note that this function modifies the Image object in place. If you need to use the full resolution image as well, apply this method to a
copy() of the original image.
Syntax: Image.thumbnail(size, resample=3)
size – Requested size.
resample – Optional resampling filter.
Returns Type: An Image object.
Another Example:Here used another image.
Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.
To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course. And to begin with your Machine Learning Journey, join the Machine Learning – Basic Level Course