SoftCropper Development for CanvasMagnet by Khaled AlamSoftCropper Development for CanvasMagnet by Khaled Alam

SoftCropper Development for CanvasMagnet

Khaled Alam

Khaled Alam

SoftCropper

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

๐Ÿค 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
Like this project

Posted Jul 14, 2025

Developed SoftCropper, a CLI tool for transforming images into square formats with annotations.