Face detection-based image cropping
Face detection-based image cropping

Crop an image based on an automatically detected face or faces by specifying the width and height (w and h in URLs), setting the gravity parameter to face or faces (g_face or g_faces in URLs), then choose the crop mode most suitable to your requirements.

With Cloudinary, cropping an image can be easily done on-the-fly in the cloud. Cloudinary can automatically detect faces' position within an image, and crop a thumbnail based on the detected face.

Here's an original image: Original

Here's a 500x500 cropped version based on the most dominant face in the image: Face detection

Cloudinary also supports detecting multiple faces. For example, here's a 500x500 cropped image based on all the detected faces in the image: Faces detection

The face and faces gravity modes are supported by the crop, fill, lfill or thumb crop modes.

When using the fill crop mode, the faces gravity mode might also come very handy. For example, here's the image cropped with the fill crop mode while using the default gravity (center): 250x500 Fill

And here's how it looks when using faces: 250x500 Fill with Faces