I am using PIL.Image.thumbnail()
to resize images whilst maintaining aspect ratio.
However I have noticed a rather annoying behaviour.
If the input image is already less than the provided WIDTH x LENGTH
it doesn’t appear to modify the image.
So in the below example:
image = Image.open(inputImage) # This is a filepath
image.thumbnail((290,290))
image.save(outputImage) # This is also a filepath :O
If the ‘inputImage’ points to an image already smaller than 290 x 290
the image saved to outputImage
is identical in size.
So my question is: Does Image.thumbnail
INCREASE an images size to match the provided size? Or is it limited to REDUCING an Images size?
Is there an input I’m missing here for my intended use of Universally resizing an image to 290×290 regardless of current size (larger or smaller)?
I haven’t been able to find any information regarding this online. If I need to use Image.resize
and calculate the aspect ratio of each image manually, I’ll do it. I just wanted to ask first 🙂