What is crop transform?

Crop transform delivers an image that is cropped and scaled to fit the bounding box specified by the user.  Crop differs from resizing because while resizing retains the entire image, cropping deletes parts of the image to accommodate the requested size.

It is recommended to crop to smaller dimensions. Requesting a larger size than the original will result in compromised image quality.

Click here to learn how to resize without cropping

How to use crop transform

ITS changes images by appending a decorator to the end of your original url string:

Resize decorator format
https://image.pbs.org/path/to/file.jpg?crop=WWxHH

Where:

  • crop -- indicates that ITS should perform a crop and use the middle of the image as the focal point for the crop.
  • WW -- a numerical pixel value representing the desired width of the output image
  • HH -- a numerical pixel value representing the desired height of the output image

How does ITS determine where to crop my image?

 
The default crops the input image from the center of the image. The image will be resized down first, depending on the lesser dimension of the image. 

Both width and height of the bounding box is required.

Live examples

Original image: https://image.pbs.org/video-assets/5jJewwH-asset-mezzanine-16x9-esGHBDK.png


Resize by:Example URLDimensions returnedImage result
700 x 200 https://image.pbs.org/video-assets/5jJewwH-asset-mezzanine-16x9-esGHBDK.png?crop=700x200 700 x 200

200 x 500https://image.pbs.org/video-assets/5jJewwH-asset-mezzanine-16x9-esGHBDK.png?crop=200x500200 x 500