PIL Image.resize() not resizing the picture PIL Image.resize() not resizing the picture python python

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 ofthe image, cropped to the requestedaspect ratio and size. The sizeargument is the requested output sizein pixels, given as a (width, height)tuple.