Crop
Get a cropped region from the original image
| Transformation | Examples | Description |
|---|---|---|
crop=left,top,width,height | crop=150,170,200,50 | request a cropped region from the original image |
crop=width,height,align | crop=150,100,face crop=150,100,left crop=150,100,right crop=150,100,top crop=150,100,bottom crop=150,100,center | request a cropped region with output centered around a area or face/feature |
crop=width,height | crop=150,100 | request a cropped region with output centered around a face/feature as default |
The transformation parameters are described below:-
| Parameter | Description |
|---|---|
left | left pixel co-ordinate for the crop |
top | top pixel co-ordinate for the crop |
width | width of the cropped image |
height | height of the cropped image |
align | alignment for automatic crop for given width and height. Can be left, right, top, bottom, center or face. face aligns the center of image to most prominent face or feature in the image. |
Examples
Crop parameters go on the asset's on-demand image URL, like every other transformation:
https://cdn.filespin.io/api/v1/assets/{ASSET_ID}/conversions?crop=400,400,face
Returns a 400x400 image centred on the most prominent face or feature.
| URL | Result |
|---|---|
https://cdn.filespin.io/api/v1/assets/{ASSET_ID}/conversions?crop=400,400,face | 400x400, centred on the face |
https://cdn.filespin.io/api/v1/assets/{ASSET_ID}/conversions?crop=400,400 | 400x400, centred on a face or feature (the default alignment) |
https://cdn.filespin.io/api/v1/assets/{ASSET_ID}/conversions?crop=600,300,top | 600x300, aligned to the top of the image |
https://cdn.filespin.io/api/v1/assets/{ASSET_ID}/conversions?crop=150,170,200,50 | the 200x50 region starting 150px from the left and 170px from the top |
https://cdn.filespin.io/api/v1/assets/{ASSET_ID}/conversions?crop=400,400,face&format=webp | a face crop, combined with other options using & |
caution
There are no w, h, width, height or gravity URL parameters. Width, height and alignment go inside the single crop value, in that order, as crop=width,height,align.