SkillAgentSearch skills...

Autocrop

A python package to crop smaller photos out of a larger image and optionally rotate crooked photos

Install / Use

/learn @msaavedra/Autocrop
About this skill

Quality Score

0/100

Supported Platforms

Universal

README

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

View on GitHub
GitHub Stars21
CategoryDevelopment
Updated3mo ago
Forks3

Languages

Python

Security Score

87/100

Audited on Dec 16, 2025

No findings