Does Python PIL resize maintain the aspect ratio?
How do I resize an image using PIL and maintain its aspect ratio?
Image.resize from PIL will do exactly as told. No behind scenes aspect ratio stuff.
Yes it will keep aspect ratio using thumbnail method:
image = Image.open(source_path)
image.thumbnail((500,500), Image.ANTIALIAS)
image.save(dest_path, "JPEG")
Recent Pillow version (since 8.3) have the following method to have an image resized to fit in given box with keeping aspect ratio.
image = ImageOps.contain(image, (2048,2048))