Smart Crop That Keeps Faces in Frame
Centre-crop ruins portraits. How saliency plus lightweight skin-tone detection picks a crop a photographer would — to any aspect ratio — without a heavyweight face model.
You need a 1:1 thumbnail from a 3:2 photo. A dumb crop takes the middle and hopes for the best — which is how you end up with a headless portrait or a perfectly centred patch of sky. Smart crop does what a photographer does: find the interesting part of the frame and keep that.
Saliency: where is the interesting stuff?
The foundation is a saliency map — a low-resolution grid scoring how visually important each region is. Two cheap signals get you most of the way:
- Local detail. Regions with high luminance variance (edges, texture, structure) are usually the subject; flat regions (walls, sky) usually are not.
- Rule-of-thirds bias. Composition favours subjects near the thirds intersections, so cells near those points get a gentle boost.
Sum those per cell and you have a map of where the photo "wants" to be cropped.
Adding face awareness without a model
Pure saliency has a blind spot: a busy background can out-score a calm, evenly-lit face. For people photos that is exactly backwards. The fix is to bias the map toward skin.
You do not need a heavyweight face-detection network for this. A classic RGB skin-tone rule — red channel dominant, red > green > blue, with enough spread — flags likely skin pixels fast. Cells with lots of skin get a strong saliency boost, so the crop holds onto faces. It stays instant and download-free, which matters for a tool that should run on any device.
Cropping to an aspect ratio
Once you have the map, cropping to a target ratio is a search: slide the target-shaped window across the grid and pick the position whose summed saliency is highest. For "auto" (no fixed ratio), instead tighten to the salient core — trim the dead borders so a near-square photo actually changes instead of just re-framing.
Where it helps most
- Thumbnails and avatars — keep the face, lose the background.
- Social crops — one source image, many aspect ratios (1:1, 4:5, 9:16), each framed sensibly.
- Batch work — apply the same smart-crop across a folder without hand-framing each one.
It will not out-think an art director on a hero image — but for the thousands of routine crops nobody has time to do by hand, "keep the interesting part, keep the face" is exactly right.