I have the following code that resizes the image by a number hardcoded
I would like it to resize using the following formula - image_size / 2
f = r'C:\Users\elazar\bucket\PHOTO'
for file in os.listdir(f):
f_img = f+"/"+file
img = Image.open(f_img).resize((540,540)).save(f_img)
Is it possible to shorten this code to fewer lines and instead of using something like 540,540 be able to cut the original size (divide) by 2
I've tried following some other formula that I couldn't fully understand here Open CV Documentation