-
Notifications
You must be signed in to change notification settings - Fork 3
A python package to crop smaller photos out of a larger image and optionally rotate crooked photos
License
msaavedra/autocrop
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
This is a python package to crop smaller photos out of a larger image and optionally rotate crooked photos. The typical use would be to scan several photos in a flatbed scanner, and use autocrop to find the photos, deskew them, and save them independently. Pipenv can be used to install dependencies (currently only pillow and numpy). Basic usage of the package is as follows: >>> from PIL import Image >>> from autocrop import MultiPartImage, Background >>> >>> # A saved scan with the scanner empty. >>> blank_img = Image.open('/path/to/blank/scan') >>> background = Background().load_from_image(blank_img, dpi=200) >>> >>> # A saved scan with multiple photos loaded in the scanner >>> scan_img = Image.open('/path/to/scanned/image') >>> scan = MultiPartImage(scan_img, background, dpi=200) >>> >>> for index, photo in enumerate(scan): ... photo.save('/path/to/cropped/image-%d.jpg' % index) Also included is a simple linux command-line script to initiate a scan and handle the cropping. It should be considered a demonstration of most of the capabilities of the package, not a utility for general wide-spread use.
About
A python package to crop smaller photos out of a larger image and optionally rotate crooked photos
Resources
License
Stars
Watchers
Forks
Releases
No releases published