Autocrop
A python package to crop smaller photos out of a larger image and optionally rotate crooked photos
Install / Use
/learn @msaavedra/AutocropREADME
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.
Related Skills
node-connect
339.1kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
83.8kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
339.1kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
commit-push-pr
83.8kCommit, push, and open a PR
