https://github.com/haofanwang/cropimage
A simple toolkit for detecting and cropping main body from pictures. Support face and saliency detection.
https://github.com/haofanwang/cropimage
crop-image cropper image-crop image-resize image-saliency main-body-crop mtcnn-face-detection opencv python smart-image-crop
Last synced: about 1 month ago
JSON representation
A simple toolkit for detecting and cropping main body from pictures. Support face and saliency detection.
- Host: GitHub
- URL: https://github.com/haofanwang/cropimage
- Owner: haofanwang
- License: apache-2.0
- Created: 2021-09-20T10:32:08.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2021-10-12T09:38:49.000Z (over 3 years ago)
- Last Synced: 2025-03-16T15:19:11.886Z (about 1 month ago)
- Topics: crop-image, cropper, image-crop, image-resize, image-saliency, main-body-crop, mtcnn-face-detection, opencv, python, smart-image-crop
- Language: Python
- Homepage:
- Size: 27.7 MB
- Stars: 44
- Watchers: 1
- Forks: 6
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# cropimage
[](https://colab.research.google.com/drive/18jqXa1V-v5FXoCcY2MVg3FC3CFcOAk63?usp=sharing) [](https://badge.fury.io/py/cropimage)  [](https://pepy.tech/project/cropimage) [](https://github.com/haofanwang/cropimage/issues)
CropImage is a simple toolkit for image cropping. Different from other projects that mainly tackle face region, we extend to all kinds of images such as landscape. We support horizontal and portrait size and generate a square output.
## Installation
~~~sh
pip install cropimage
~~~## Get Started
~~~python
from cropimage import Croppercropper = Cropper()
# Get a Numpy array of the cropped image
# Set completeness to be True if you expect the 'face' to be focused rather than 'person'
# Set target_size to be a tuple (size, size), only square output is supported now
result = cropper.crop('./images/input.jpg')# Save the cropped image
cv2.imwrite('cropped.jpg', result)
~~~## More Results
## Contributing
If you find any issue of this project, feel free to open an issue or contribute!