Repository navigation
autocrop 2.0.0 is a breaking release for face-aware image cropping from Python and the shell.
Cropper.crop()returns a typedCropResult: read.imagefor the crop and.diagnosticsfor that attempt.- The CLI processes one image at a time, supports stdin/stdout pipelines, and writes safe JSON reports with
--json. - Use
align=Trueor--alignto rotate faces so they're level using eye landmarks before cropping. - YuNet replaces Haar detection. Automatic brightening and directory-scanning mode are removed.
- Tested on Python 3.10–3.15 across Linux, macOS, and Windows. Requires OpenCV 4.8+ and Pillow 12.3.0+.
Upgrading from v1
Python: replace image = cropper.crop(source) with image = cropper.crop(source).image and check that image for None.
CLI: replace directory-mode commands with a shell loop; choose an output format with -o cropped.png. Use -V or --version for the version; -v now enables timings.
Read the migration FAQ before upgrading. It covers removed APIs, error messages, rollback, and changes to pixels/colors. The API docs also list the SDK limitations deferred to follow-up work, including input-array mutation with resize=False; pass a copy when reusing arrays.
python -m pip install --upgrade 'autocrop==2.0.0'