Input image size dimension (a,b)
output image size (c,d) where c> =k and d >= k
Example: input image(900,600) with minimum dimension k= 400
then output image should be (600,400)
Is there any function from PIL.Image to achieve this goal?
Input image size dimension (a,b)
output image size (c,d) where c> =k and d >= k
Example: input image(900,600) with minimum dimension k= 400
then output image should be (600,400)
Is there any function from PIL.Image to achieve this goal?
You can't use the usual "thumbnail", as it is designed for the more usual requirement of having a maximum dimension. Instead you can use "resize" method, after having computed the wanted size. Something like:
if image.width >= k and image.height >= k:
if image.height < image.width:
factor = float(k) / image.height
else:
factor = float(k) / image.width
image.resize((image.width* factor, image.height * factor))