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 Python tool that automatically resizes rectangular images into squares and adds soft, blurred borders — ideal for prepping images for print or display.

This package is part of the internal tools used at CanvasMagnet for order preparation and production automation.



📸 Example Results

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

🚀 Features

  • Pads any image to a perfect square
  • Fills padding using soft Gaussian blur from original image
  • Automatically saves output in a separate folder

📦 Requirements

  • Python >= 3.7
  • opencv-python
  • numpy

🔧 Installation

pip install softcropper

⚙️ Usage

softcropper ./path/input_photos ./path/output_ready --mode blur
  • input_photos: folder with png, jpg, jpeg, or webp files
  • output_photos: optional (defaults to ./input_photos/output/)
  • modes: blur, solid, gradient

✅ Testing

PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 pytest tests/test_softcropper.py -v

📄 Changelog

CHANGELOG.md

🛠️ Makefile Commands

make venv         # create .venv
make install      # install in editable mode
make test         # run unit/integration tests
make build        # build for PyPI
make clean        # remove all build artifacts and caches

🤝 Contribution

Pull requests are welcome! If you'd like to suggest improvements or fix issues, feel free to fork and submit.

Author

Khaled Alam

📧 khaledalam.net@gmail.com
🌍 Website | LinkedIn | X(Twitter)

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.8.tar.gz (8.8 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.8-py3-none-any.whl (7.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: softcropper-0.1.8.tar.gz
  • Upload date:
  • Size: 8.8 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.8.tar.gz
Algorithm Hash digest
SHA256 47eb1fbc4dee068f7a7b72e6d23f3ed96c1c53439c675375301b72a40497fb18
MD5 467ecad29e2070f924ca1fb66ff79db3
BLAKE2b-256 2aea7ec981a66583abcd2721ac63d4544f1d35cee7a1babb158b101976bfd06f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: softcropper-0.1.8-py3-none-any.whl
  • Upload date:
  • Size: 7.2 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.8-py3-none-any.whl
Algorithm Hash digest
SHA256 f7cc9683ebb8037fd56a586c2fb8992833da598c63ec41de4e29b1adcb9a5ccd
MD5 debc3463a286b0601fbdfcafbca82e26
BLAKE2b-256 5fe760245d0dd69e45c47528d28b92431fec3bd37209ad0a1d2ee452c24a1be4

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