Skip to main content

SoftCropper

PyPI version License: MIT Build Status Python

SoftCropper is a powerful CLI tool that transforms rectangular images into square, print-ready formats with aesthetic borders and customizable text annotations — built for precision and automation.

Actively used by CanvasMagnet for order prep and A4 layout automation.



📸 Example Results

Before ➡️ After
Baby.webp (600×900)
Output (900×900)
Kid.jpg (1100×733)
Output (1100×1100)

A4:

🚀 Features

  • ✅ Auto-square images with optional blurred/solid/gradient padding
  • 🖼️ Add customizable rounded borders around photos
  • ✍️ Annotate left/right/top/bottom with vertical or centered text (great for branding)
  • 📄 Generate auto-arranged A4 collage pages from processed photos
  • 📐 Resize final output by target size (e.g. --size 5.5x5.5cm or --size 55x55mm)
  • 🧪 Includes CLI, Makefile, tests, and PyPI packaging

📦 Requirements

  • Python >= 3.7
  • opencv-python
  • numpy

🔧 Installation

pip install softcropper

For local development:

make venv
make install

⚙️ CLI Usage

softcropper ./input_photos --mode blur --border --text \
  --left "@CanvaMagnet" \
  --right "+971 545800462" \
  --top "Preview" \
  --bottom "www.CanvaMagnet.com" \
  --size 5.5x5.5cm \
  --a4

Options

Flag Description
--mode One of: blur (default), solid, gradient
--border Add rounded frame around photo
--text Enable text mode (requires at least one --left/right/top/bottom)
--left Vertical text on left side
--right Vertical text on right side
--top Centered text above the image
--bottom Centered text below the image
--size Resize output image (supports mm or cm, e.g. 55x55mm)
--a4 Generate A4 page(s) from processed images

✅ Testing

make test

Or manually:

PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 pytest tests/ -v

🛠️ Makefile Commands

make venv         # Create .venv
make install      # Install locally in editable mode
make test         # Run tests
make build        # Build wheel and source dist
make deploy       # Deploy to PyPI
make clean        # Remove virtualenv + build artifacts

📄 Changelog

See CHANGELOG.md


🤝 Contribution

Pull requests are welcome! Open an issue or fork and submit a PR if you'd like to improve SoftCropper.


Author

Khaled Alam
📧 khaledalam.net@gmail.com
🌍 Website | LinkedIn | Twitter/X

Metadata

Release files for softcropper 0.1.9

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for softcropper 0.1.9
File Size Uploaded
softcropper-0.1.9.tar.gz 9.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for softcropper 0.1.9
File Interpreter ABI Platform
softcropper-0.1.9-py3-none-any.whl Python 3 none any Details

Total release size: 17.3 kB

Release files / softcropper-0.1.9.tar.gz

Download URL softcropper-0.1.9.tar.gz
Size 9.6 kB
Tags Source
SHA-256 checksum
How to use checksums
ae8596e65db4bcbaf656ce90b995cf1bf928fba9acadfe159341a3c4c693ad32
BLAKE2b-256 checksum
How to use checksums
34c499997b48f642bb4fed0e50c24bb1a058a3b549d42d50545523a0d52f3e6a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.5

Release files / softcropper-0.1.9-py3-none-any.whl

Download URL softcropper-0.1.9-py3-none-any.whl
Size 7.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a623e3e3c06374c8318c67d6c213f98b8316487a70a3d8ba079dc909a459518c
BLAKE2b-256 checksum
How to use checksums
ad026c9a501286e794149ba3d9f98536e6f02abd4e902dd94916566987a0be6b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.5

Release history Release notifications | RSS feed

This release

0.1.9 This release

2 release files

0.1.8

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page