You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I want to downscale/resize an image to a minimum size without changing its aspect ratio. This could be useful for shrinking large profile pictures, or shrinking an image to save processing time during future operations on an image.
How would you expect it to be implemented?
I'd like to call a function on an Image object, like downscale_to_min(img, min_width, min_height).
There a similar function to this, thumbnail(), where you set the maximum size to scale an image to. It's like drawing a box around an image, and making sure no side of the image grows over the borders. I tried to visualize it here, red are the borders (the maximum size passed to thumbnail(), and green is the image:
Click to expand
This function would be similar, except the box is now on the inside of the image, and the no side can shrink under the borders
Again, visualized:
Click to expand
What are your OS, Python and Pillow versions?
OS: Fedora Linux 38
Python: 3.11
Pillow: 10.0.1
This is a basic function that implements the functionality using existing PIL functions.
I think that ImageOps is a better home for this than Image, since we have similar methods there already. I've created PR #7412 to add the new function.
What do you want to do?
I want to downscale/resize an image to a minimum size without changing its aspect ratio. This could be useful for shrinking large profile pictures, or shrinking an image to save processing time during future operations on an image.
How would you expect it to be implemented?
I'd like to call a function on an
Image
object, likedownscale_to_min(img, min_width, min_height)
.Example:
Any context?
There a similar function to this,
thumbnail()
, where you set the maximum size to scale an image to. It's like drawing a box around an image, and making sure no side of the image grows over the borders. I tried to visualize it here, red are the borders (the maximum size passed tothumbnail()
, and green is the image:Click to expand
This function would be similar, except the box is now on the inside of the image, and the no side can shrink under the borders
Again, visualized:
Click to expand
What are your OS, Python and Pillow versions?
This is a basic function that implements the functionality using existing PIL functions.
The text was updated successfully, but these errors were encountered: