Top AI Repos — open-source AI, indexed and scored
Top AI Repos tracks AI repositories on GitHub and answers two different questions about each one: is it moving right now, and would you bet a product on it.
Top AI Repos tracks AI repositories on GitHub and answers two different questions about each one: is it moving right now, and would you bet a product on it.
📸 Automatically detects and crops faces from batches of pictures.
| Date | Stars |
|---|---|
| 2026-07-24 | 664 |
| 2026-07-25 | 664 |
| 2026-07-28 | 665 |
| 2026-07-30 | 665 |
| 2026-08-06 | 665 |
Today
— stars today
This week
— stars this week
This month
— stars this month
Momentum
0.0
growth rate 0.00%/day
# autocrop
<p align="center">
<img src="docs/assets/social-preview.svg" alt="autocrop: crop images around faces from Python or the shell" width="760">
</p>
[](https://github.com/leblancfg/autocrop/actions/workflows/ci.yml) [](https://leblancfg.com/autocrop) [](https://badge.fury.io/py/autocrop) [](https://pepy.tech/project/autocrop)
<p align="center"><img title="obama_crop" src="https://cloud.githubusercontent.com/assets/15659410/10975709/3e38de48-83b6-11e5-8885-d95da758ca17.png"></p>
Perfect for profile picture processing for your website or batch work for ID cards, autocrop will
output images centered around the biggest face detected.
# Installation
Simple!
```sh
pip install autocrop
```
# Use
Autocrop can be used [from the command line](#from-the-command-line) or directly
[from Python API](#from-python).
## From the command line
usage: autocrop [-h] [-V] [-v] [-n] [-o OUTPUT] [-w WIDTH] [-H HEIGHT]
[--facePercent FACEPERCENT]
[source]
Automatically crops faces from pictures
positional arguments:
source Image file, or '-' to read image bytes from stdin.
options:
-h, --help show this help message and exit
-V, --version show program's version number and exit
-v, --verbose Write timings and basic processing details to stderr
-n, --no-resize Do not resize images to the specified width and
height, but instead use the original image's pixels.
-o, --output, -p, --path OUTPUT
Output file, or output directory for a single input
image. If omitted, cropped image bytes are written to
stdout.
-w, --width WIDTH Width of cropped files in px. Default=500
-H, --height HEIGHT Height of cropped files in px. Default=500
--facePercent FACEPERCENT
Percentage of face to image height
## From Python
Import the `Cropper` class, set some parameters (optional), and start cropping.
The `crop` method accepts filepaths or OpenCV-style BGR/BGRA `np.ndarray` inputs, and returns
RGB/RGBA Numpy arrays. These are easily handled with
[PIL](https://pillow.readthedocs.io/) or [Matplotlib](https://matplotlib.org/).
```python
from PIL import Image
from autocrop import Cropper
cropper = Cropper()
# Get a Numpy array of the cropped image
cropped_array = cropper.crop('portrait.png')
# Save the cropped image with PIL if a face was detected:
if cropped_array is not None:
cropped_image = Image.fromarray(cropped_array)
cropped_image.save('cropped.png')
```
Autocrop v2 uses OpenCV's YuNet neural-network face detector.
Further examples and use cases are found in the
[accompanying Jupyter Notebook](https://github.com/leblancfg/autocrop/blob/master/examples/visual_tests.ipynb).
### Examples
- Crop one image and write the cropped image bytes to stdout:
- `autocrop portrait.jpg > cropped.jpg`
- Crop image bytes from stdin. This uses `-` instead of `--` because `--` is already argparse's
standard option terminator:
- `cat portrait.jpg | autocrop - > cropped.jpg`
- `autocrop -- > cropped.jpg < portrait.jpg`
- Crop one image and write to an explicit output file:
- `autocrop portrait.jpg -o cropped.jpg`
- Print timings and basic processing details to stderr:
- `autocrop portrait.jpg --verbose > cropped.jpg`
- Crop one image and write into an explicit output directory:
- `autocrop portrait.jpg -o crop`
- Convert output format by choosing an explicit output extension:
- `autocrop portrait.jpg -o cropped.png`
- Crop one image but keep the original crop pixels instead of resizinExcerpt of 8,207 characters
Read on GitHubWould you bet a product on this? Bounded 0–100 and slow moving.
matched fp:6c1ebaaea0cebab7, topic:computer-vision, topic:opencv