Skip to main content

Auto-crop images

Project description

Py-Cropper

Py-Cropper is a Typer-powered command-line utility that trims uniform white borders from common bitmap formats using Pillow. It can process single files, batches and (on Windows) integrates with File Explorer via a right-click verb.

Requirements

  • Python 3.8+
  • Pillow and Typer (installed automatically when using pip install)
  • Windows is only required for the optional context-menu verb

Installation

# Install from PyPI (preferred)
pip install py-cropper

# ...or install from a local clone
git clone https://github.com/mr-szgz/py-cropper.git
cd py-cropper
pip install .

The installer registers a cropper console entry point. On Windows it will also attempt to add the File Explorer verb automatically when pip install is executed.

Usage

# Crop a single file (writes <name>-cropped.<ext> by default)
cropper crop example.png

# Force the output path
cropper crop example.png --output clean.png

# Process several files and log errors individually
cropper crop image1.jpg image2.jpg

# Process every supported image located next to <seed>.png
cropper crop seed.png --include-siblings

# Keep more of the light border by increasing tolerance (0-255)
cropper crop scan.png --tolerance 230

CLI help is always available with cropper --help or cropper crop --help.

Uninstall

pip uninstall py-cropper

Uninstalling removes the CLI entry point. If you previously added the Explorer verb, remove it manually (see below) before uninstalling or reinstall directly from source to re-register it.

Context Menu (Windows)

Py-Cropper ships with helpers to create a Crop with Py-Cropper entry when you right-click an image in File Explorer.

# Install the verb (requires existing cropper.exe/scripts entry)
cropper context-menu install

# Remove the verb
cropper context-menu remove

Optional switches:

  • --executable PATH – run a custom cropper executable/script when the verb fires (defaults to the current cropper command).

If the verb ever breaks because the executable moved, re-run cropper context-menu install --executable <new-path> or uninstall/reinstall the package to refresh the registry keys.

[!WARNING] This package was primarily developed with AI assistants: GPT-5, GPT-5-Codex, GPT-5.1, and GPT-5.1-Codex. Reasoning mode stays on Medium by default—High reasoning has consistently produced worse outcomes for this workflow.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pycropper-0.1.0.tar.gz (5.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pycropper-0.1.0-py3-none-any.whl (4.9 kB view details)

Uploaded Python 3

File details

Details for the file pycropper-0.1.0.tar.gz.

File metadata

  • Download URL: pycropper-0.1.0.tar.gz
  • Upload date:
  • Size: 5.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.16

File hashes

Hashes for pycropper-0.1.0.tar.gz
Algorithm Hash digest
SHA256 e04520efe446075388f3669cb4f411b1335ec2f5cf5877c39b910fac95595efa
MD5 d723512179be26c2d2c3e5198a58f1e3
BLAKE2b-256 7d2db28d8d8c708ee0aa67154cc3f87ed3a5d4c415e07eadb72754e2ff833d55

See more details on using hashes here.

File details

Details for the file pycropper-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: pycropper-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 4.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.16

File hashes

Hashes for pycropper-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f6f9d79533d8bb75e762a0a11fb460b75248a3cfc8366f709c30e9082dcb0ab1
MD5 e2114fca753956ed9849f93eac628ec9
BLAKE2b-256 bc7af4dae932842718f78616c0360bae9bd342fb06fee4812aefffeeb6975378

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page