To change the image size to fit in given width and height while retaining original proportions, specify the width
and height
parameters (w
and h
in URLs) while setting the crop
parameter to fit
(c_fit
in URLs).
When using the 'fit' crop mode, all original image parts are visible. Both width and height dimensions of the transformed image must not exceed the specified width & height. However, they may be smaller than the specified values in order to keep the original proportion.
Here's an original image:
Here's how to make the image fit within 70x90 boundaries:
Note that the result image is actually 70x47 in order to keep the original proportions of 864x567 (~1.5).
Here's an example of fitting the original image to 300x100, which will generate a 150x100 image (retaining the 1.5 aspect ratio):
The 'fit' crop mode can be applied on overlays as well:
Note that the fit
crop mode enlarges the image when requesting larger width
and height
than the original image's dimensions. For example (original is 912x608):