I want to resize my images to the following ratios :rescale images in the range x0.5, x0.75, x0.9, x1.1 x1.25, x1.5 basically all i want to give as input is let's say 0.5 and all the images in my folder will have their sizes in half . Note that my images have different sizes and yes i know how to get the height and width of an image and multiply it by an input and yes i have checked this previous question on here How do I resize an image using PIL and maintain its aspect ratio? but is there a better way to do it since then?
Edit: Is something like this possible:
import os
from PIL import Image
path = path_to_input_images
for filename in os.listdir(path + 'image/'):
im = Image.open(path + 'image/' + filename)
im.size = list(im.size)
im.size[0] = int(float(im.size[0]) * 0.5)
im.size[1] = int(float(im.size[1]) * 0.5)
im.size = tuple(im.size)
im.save(path + 'resized_images'+ filename)
but i got an error that ValueError: tile cannot extend outside image