In this tutorial, we will use an example to show how to create thumbnail images using python pillow Image.thumbnail().
1.Open an image
from PIL import Image img = Image.open('test.jpg')
2.Set thumbnail image width and height
thumb_size = (300, 300)
3.Create thumbnail image using Image.thumbnail()
img.thumbnail(thumb_size) img.show()
Run this code, you will see this thumbnail image:
You also can resize an image to create thumbnail image, you can read this tutorial:
Python Pillow: Resize an Image Using Image.resize() – A Step Guide