Skip to main content

Resize and blur-pad photos to square format for photos

Project description

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

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

softcropper-0.1.9.tar.gz (9.6 kB view details)

Uploaded Source

Built Distribution

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

softcropper-0.1.9-py3-none-any.whl (7.7 kB view details)

Uploaded Python 3

File details

Details for the file softcropper-0.1.9.tar.gz.

File metadata

  • Download URL: softcropper-0.1.9.tar.gz
  • Upload date:
  • Size: 9.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.5

File hashes

Hashes for softcropper-0.1.9.tar.gz
Algorithm Hash digest
SHA256 ae8596e65db4bcbaf656ce90b995cf1bf928fba9acadfe159341a3c4c693ad32
MD5 503fc4ced8512ad28a0ca1343845614c
BLAKE2b-256 34c499997b48f642bb4fed0e50c24bb1a058a3b549d42d50545523a0d52f3e6a

See more details on using hashes here.

File details

Details for the file softcropper-0.1.9-py3-none-any.whl.

File metadata

  • Download URL: softcropper-0.1.9-py3-none-any.whl
  • Upload date:
  • Size: 7.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.5

File hashes

Hashes for softcropper-0.1.9-py3-none-any.whl
Algorithm Hash digest
SHA256 a623e3e3c06374c8318c67d6c213f98b8316487a70a3d8ba079dc909a459518c
MD5 e570dd35268cf0d2141c2c29d8424175
BLAKE2b-256 ad026c9a501286e794149ba3d9f98536e6f02abd4e902dd94916566987a0be6b

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