Skip to main content

Crop

Get a cropped region from the original image

TransformationExamplesDescription
crop=left,top,width,heightcrop=150,170,200,50request a cropped region from the original image
crop=width,height,aligncrop=150,100,face crop=150,100,left crop=150,100,right crop=150,100,top crop=150,100,bottom crop=150,100,centerrequest a cropped region with output centered around a area or face/feature
crop=width,heightcrop=150,100request a cropped region with output centered around a face/feature as default

The transformation parameters are described below:-

ParameterDescription
leftleft pixel co-ordinate for the crop
toptop pixel co-ordinate for the crop
widthwidth of the cropped image
heightheight of the cropped image
alignalignment 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.

URLResult
https://cdn.filespin.io/api/v1/assets/{ASSET_ID}/conversions?crop=400,400,face400x400, centred on the face
https://cdn.filespin.io/api/v1/assets/{ASSET_ID}/conversions?crop=400,400400x400, centred on a face or feature (the default alignment)
https://cdn.filespin.io/api/v1/assets/{ASSET_ID}/conversions?crop=600,300,top600x300, aligned to the top of the image
https://cdn.filespin.io/api/v1/assets/{ASSET_ID}/conversions?crop=150,170,200,50the 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=webpa 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.