Overview
Sources
Libraries
Images API

Crop Mode crop

Specifies the mode that will be used to perform a crop of the image when mode=crop is used.

Values

Accepted values for this parameter are a position value, attention, entropy and face.

The default value of this parameter is the position value center,middle so the cropping will be horizontally and vertically centered.

For more information on how to specify positions visit the position values section.

Position Value

It is possible to use a position value to specify what point of the image should be use as the center for the cropping.

In this example we are cropping the source with mode=crop and setting the center of the crop to the horizontal left and vertical middle position with crop=left,middle:

GET
https://assets.imglab-cdn.net/beach.jpeg?mode=crop&crop=left%2Cmiddle
A couple at the beach, cropped with crop mode and moving cropping center to left and middle using crop parameter.
x px

In this example we are cropping the source with mode=crop and setting the center of the crop to horizontal right and vertical middle position with crop=right,middle:

GET
https://assets.imglab-cdn.net/beach.jpeg?mode=crop&crop=right%2Cmiddle
A couple at the beach, cropped with crop mode and moving cropping center to right and middle using crop parameter.
x px

Attention

Attention mode will set the center of the crop to the point with the highest luminance, saturation and presence of skin tones.

In this example we are using mode=crop and crop=attention setting the center of the crop to the attention point:

GET
https://assets.imglab-cdn.net/beach.jpeg?mode=crop&crop=attention
A couple at the beach, cropped with crop mode and moving cropping center to the image attention point with crop parameter using attention value.
x px

Entropy

Entropy mode will set the center of the crop to the point with the highest Shannon entropy.

In this example we are using mode=crop and crop=entropy so the center of the image will be the point with the highest entropy:

GET
https://assets.imglab-cdn.net/beach.jpeg?mode=crop&crop=entropy
A couple at the beach, cropped with crop mode and moving cropping center to the highest entropy point with crop parameter using entropy value.
x px

Face

Face mode will set the center of the crop to the center of the face or faces detected in the image. If no faces are detected the crop will be the default position value center,middle.

It is possible to use face-number parameter to specify one of the detected faces to be the center of the crop.

In this example we are using mode=crop and crop=face so the cropping will be centered in the center of the detected faces:

GET
https://assets.imglab-cdn.net/couple.jpeg?mode=crop&crop=face
A couple taking a selfie, cropped with crop mode and moving cropping center to the center of all the faces using crop parameter with face value.
x px

For this example we are specifying the first detected face to be used as the center of the crop with face-number=1:

GET
https://assets.imglab-cdn.net/couple.jpeg?mode=crop&crop=face&face-number=1
A couple taking a selfie, cropped with crop mode and moving cropping center to the center point of the first face setting face-number parameter to 1.
x px

For this last example we are specifying the second detected face to be used as the center of the crop with face-number=2:

GET
https://assets.imglab-cdn.net/couple.jpeg?mode=crop&crop=face&face-number=2
A couple taking a selfie, cropped with crop mode and moving cropping center to the center point of the second face setting face-number parameter to 2.
x px