What is smart crop?
Smart crop returns an image focused around a user-specified point in the original image of a user-specified size.
How to use smart crop
To use this crop, the input image filename must end in _focus-XXxYY.ext. Then use
the crop
keyword with two arguments split by x's, as shown in the following example:
Smart crop example
https://image.pbs.org/path/to/file_focus-XXxYY.ext?crop=WWxHH
Where:
- XX -- the x axis of the focal point, represented as a percentage value of the height of the original picture
- YY -- the y axis of the focal point, represented as a percentage value of the height of the original picture
- crop -- indicates that ITS should perform a 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
Live examples
Original image: https://image.pbs.org/test/Sjk2Eqs-asset-mezzanine-16x9-0gsKw4z_focus-90x10.png
Resize by: | Example URL | Dimensions returned | Image result |
---|---|---|---|
300 x 400 | https://image.pbs.org/test/Sjk2Eqs-asset-mezzanine-16x9-0gsKw4z_focus-90x10.png?crop=300x400 | 300 x 400 |