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.
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
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
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
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
Face crop=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
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
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