Overview
Sources
Libraries
Images API

Face Number face-number

Specify which face from the image should be used when mode=face or mode=crop and crop=face are used.

Faces are numbered from left to right on the image. Starting from 1 to the maximum number of faces detected.

Values

This parameter accepts integer values in the range 1 to the number of detected faces with 0 disabling the effect of the parameter.

The default value for this parameter is 0.

Examples

We will use the following image for these examples:

GET
https://assets.imglab-cdn.net/couple-02.jpeg?width=900
Female couple image resized using width and height parameters.
x px

If face-number is not set and mode=face is used the image will be resized trying to fit all the detected faces in the image:

GET
https://assets.imglab-cdn.net/couple-02.jpeg?width=900&height=600&mode=face
Female couple image resized fitting all detected faces with face mode.
x px

Using face-number=1 the image will be resized fitting the area of the first detected face:

GET
https://assets.imglab-cdn.net/couple-02.jpeg?width=900&height=600&mode=face&face-number=1
Female couple image resized fitting first detected face setting face-number parameter value to 1.
x px

Using face-number=2 the image will be resized fitting the area of the second detected face:

GET
https://assets.imglab-cdn.net/couple-02.jpeg?width=900&height=600&mode=face&face-number=2
Female couple image resized fitting second detected face setting face-number parameter value to 2.
x px

With mode=face it's possible to use face-padding parameter to increase the face area padding:

GET
https://assets.imglab-cdn.net/couple-02.jpeg?width=900&height=600&mode=face&face-number=2&face-padding=4.0
Femaile couple image resized fitting second detected face setting face-number parameter value to 2 and with a face padding of 4.0 using face-padding parameter.
x px

face-number can be used with mode=crop and crop=face parameters too. In this example we are using face-number=1 setting the center of the crop to the first detected face:

GET
https://assets.imglab-cdn.net/couple-02.jpeg?width=600&height=600&mode=crop&crop=face&face-number=1
Female couple image cropped to face with face crop mode and fitting first detected face with face-number parameter value to 1.
x px

For this example we are using face-number=2 that will change the center of the crop to the second detected face:

GET
https://assets.imglab-cdn.net/couple-02.jpeg?width=600&height=600&mode=crop&crop=face&face-number=2
Female couple image cropped to face with face crop mode and fitting second detected face with face-number parameter value to 2.
x px

If not face-number is set using mode=crop and crop=face the cropping center will be set to be the center of all detected faces:

GET
https://assets.imglab-cdn.net/couple-02.jpeg?width=600&height=600&mode=crop&crop=face
Female couple image cropped to face with face crop mode and fitting to all detected faces without specifying a face-number parameter.
x px