Intro

Today, I’m excited to open up and share a small part of the customized automation tools I’ve been building behind the scenes to power CanvaMagnet — my personalized photo magnet business. One of the most repetitive challenges in preparing customer orders was manually resizing and formatting each image for production.

To solve this, I developed a Python CLI tool named SoftCropper, designed to automatically square images and add blurred borders, making them perfectly print-ready. After using it internally to streamline our order prep and reduce production time, I decided to open source it so others can benefit too.


The Problem

CanvasMagnet prints square photo magnets — but most customer-submitted photos are vertical or horizontal. Cropping them loses content, padding them looks bad, and doing it by hand slows things down.


The Solution

With OpenCV and NumPy, I built two core functions:

  • make_square() — adds black padding to make any image square
  • add_blurred_borders() — extracts edge pixels, expands them, and applies Gaussian blur

The result: a beautiful soft-bordered square that looks pro — and prints perfectly.

➡️


Packaging It

I wrapped the logic in a CLI tool, made it pip-installable, added setup.py, cli.py, and a clean project structure.


Testing and CI

  • ✅ I added unit tests using real .webp and .jpg images
  • ✅ GitHub Actions now runs those tests on each push
  • ✅ I even automated patch-version bumping using Makefile

Published on PyPI

You can now install it with:

pip install softcropper

Use it like:

softcropper ./input_photos ./output_ready

It will:

  • Detect all supported images
  • Make them square
  • Blur the padding
  • Save them for print

What’s Next

I’ll likely expose more internal tools that help automate the production pipeline at CanvaMagnet. If you’re prepping images for print, e-commerce, or social, this tool might save you hours.


Links

Leave a Reply

Your email address will not be published. Required fields are marked *