PIL Image.resize() not resizing the picture

resize() returns a resized copy of an image. It doesn’t modify the original. The correct way to use it is:

from PIL import Image
#...

img = img.resize((150, newheight), Image.ANTIALIAS)

source

I think what you are looking for is the ImageOps.fit function. From PIL docs:

ImageOps.fit(image, size, method, bleed, centering) => image

Returns a sized and cropped version of
the image, cropped to the requested
aspect ratio and size. The size
argument is the requested output size
in pixels, given as a (width, height)
tuple.

Leave a Comment