Fitting an image within specified dimensions

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).

Original

Original

Fit 70x90

Fit 70x90

300x100 fit

300x100 fit
Ruby:
cl_image_tag("flower.jpg", :width=>70, :height=>90, :crop=>"fit")
PHP:
cl_image_tag("flower.jpg", array("width"=>70, "height"=>90, "crop"=>"fit"))
Python:
CloudinaryImage("flower.jpg").image(width=70, height=90, crop="fit")
Node.js:
cloudinary.image("flower.jpg", {width: 70, height: 90, crop: "fit"})
Java:
cloudinary.url().transformation(new Transformation().width(70).height(90).crop("fit")).imageTag("flower.jpg")
JS:
cl.imageTag('flower.jpg', {width: 70, height: 90, crop: "fit"}).toHtml();
jQuery:
$.cloudinary.image("flower.jpg", {width: 70, height: 90, crop: "fit"})
React:
<Image publicId="flower.jpg" >
  <Transformation width="70" height="90" crop="fit" />
</Image>
Angular:
<cl-image public-id="flower.jpg" >
  <cl-transformation width="70" height="90" crop="fit">
  </cl-transformation>
</cl-image>
.Net:
cloudinary.Api.UrlImgUp.Transform(new Transformation().Width(70).Height(90).Crop("fit")).BuildImageTag("flower.jpg")
by Itay Taragano