leblancfg/autocrop
📸 Automatically detects and crops faces from batches of pictures.
What it solves
Autocrop is a tool designed to automate the process of cropping images to focus on faces. It eliminates the manual effort of cropping profile pictures or ID card photos by automatically detecting the largest face in an image and centering the crop around it.
How it works
The tool uses OpenCV's YuNet neural-network face detector (specifically the face_detection_yunet_2023mar.onnx model) to locate faces within an image. It can be used as a Python API or a command-line interface (CLI) to process images, allowing users to specify output dimensions, resize options, and the percentage of the image height that the face should occupy.
Who it’s for
It is intended for developers and system administrators who need to batch-process images for websites, ID cards, or other applications where face-centered cropping is theusecase.
Highlights
- own a CLI and a Python API for flexible integration.
- Supports a wide variety of input and output image formats.
- Works offline by bundling the YuNet detector model.
- Can be composed with shell tools like
find,xargs, andparallelfor high-volume batch processing. - Supports processing frames extracted from video files via
ffmpeg.