Python: How to resize an image using PIL module

You need to set the format parameter in your call to the save function to ‘JPEG’:

from PIL import Image
img = Image.open('car.jpg')
new_img = img.resize((500,500))
new_img.save("car_resized.jpg", "JPEG", optimize=True)

Leave a Comment