Skip to content


Ensures that the image is no larger than specified dimensions.

If the source image is larger, it will be scaled down, maintaining aspect ratio.

If the source image is smaller, it will be returned unmodified.

This is useful when you want to ensure images do not exceed a give size, but you don't want to scale up the image if is already smaller.


Using this image scaled to 640 x 360 as our input:

source image

Code Output
image.bound(400, 300) image
image.bound(500, 200) image
image.bound(300, 500) image