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 example.png

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

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

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

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

CLI help is always available with cropper --help or cropper --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.6.tar.gz (5.7 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.6-py3-none-any.whl (4.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pycropper-0.1.6.tar.gz
  • Upload date:
  • Size: 5.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pycropper-0.1.6.tar.gz
Algorithm Hash digest
SHA256 623db975fef0eb5c2cb3dc1a44058608c7e8255a9ca41169bb928ac5336a3d9b
MD5 ea8fe2a9472b3834901a611c15160547
BLAKE2b-256 03a7f5e4f734a7925bbefb5507f27e0badd134c7aa06cd67baa3c75474f5fc58

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for pycropper-0.1.6-py3-none-any.whl
Algorithm Hash digest
SHA256 2602997c80eb3a6900a4455439202ebd973a8b2e6f732a3dc33b88688ea86fd1
MD5 aa8760e4a4f640e1bec65e86e462405f
BLAKE2b-256 0bbfd2ddeae39296dc91a19ed0d4245d18f6392dd30e6126379b5edf592c60e8

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