The Face Detection API uses AI to automatically detect faces in your images and create intelligent crops that keep people in frame.Documentation Index
Fetch the complete documentation index at: https://docs.bunny.net/llms.txt
Use this file to discover all available pages before exploring further.
Face detection processing happens on the first request. The result is cached
at the edge for instant delivery on subsequent requests.
Parameter
Automatically detect faces and center the crop around them.Format 1 (Boolean): Set to
true to detect all faces and ensure they’re in frame with padding. If no faces are
detected, the image will not be cropped.Format 2 (Dimensions): Specify width,height to crop the image using the specified dimensions, with detected faces
as the center point. If no faces are detected, the image is still cropped from the centre.How it works
When you enable face detection, Bunny Optimizer:- Scans the image for human faces
- Identifies all detected faces
- Calculates the optimal center point (average of all face positions)
- Crops the image to keep faces in frame with appropriate padding
Usage
Automatic padding
Setface_crop=true to automatically detect faces and add padding around them. The algorithm ensures all detected faces remain in frame with intelligent padding.
| Original | With face_crop=true |
|---|---|
![]() | ![]() |
Dimensions (fixed size)
Specify exact dimensions usingwidth,height in pixels to crop around detected faces. Bunny Optimizer finds all faces and centers the crop at the average position.
Portrait crop
Square thumbnail
| Original | face_crop=800,1000 |
|---|---|
![]() | ![]() |
Multiple faces
When multiple faces are detected:- Bunny Optimizer calculates the center point between all faces
- The crop is positioned to include as many faces as possible
- With dimension mode, faces are prioritized at the center of the crop
- The single face becomes the center point
- Padding is added around the face (boolean mode)
- The face is centered in the specified dimensions (dimension mode)
Combining with other transformations
Face detection works seamlessly with other parameters:Face crop with brightness adjustment
Face crop with aspect ratio
Face crop with blur


