Skip to content

Soo, I did a thing.... #11

@shalak

Description

@shalak

First of all - this project is awesome, by far it's the most convenient bulk-cropper I stumbled uppon. My usecase is to prepare digital photos for printing in a fast and convenient manner.

However, some things bugged me. It started simply - I just wanted to wrap this project into a nice Dockerfile, because I prefer to self-host tools like this.

Since I've always kept myself far from frontend, I figured, in this day and age, I shall give wibe coding a chance.

After dockerization, I figured, that I'd like for the default black background fill of the cropped pictures to be configurable... and then I wanted convenient way to zoom into the exact width/height of a picture, and then one thing led to another, and 3 evenings later I got the following features working:

  • Dockerized prod and dev build
  • aspect ratio can be set by a single text input (as 1:2, 1x2 or 0.5)
  • aspect ratio comes with popular presets
  • fixed issue selecting aspect ratio does not work (?) #3
  • ratio can be changed without unloading all pictures
  • ratio can be auto-calculated from picture dimensions
  • ratio can be reversed with a single click
  • sliders have +/- step clickable icons
  • picture can be re-centered in canvas
  • zoom has 3 convenient buttons for fitting width, height or whatever's longer (auto-fit)
  • the above works even for rotated pictures
  • rotate comes with 4 convenient buttons for round rotation values (-90, 0, 90, 180)
  • rotate slider snaps to round rotation values
  • moving picture across canvas snaps to canvas edges (with visual indicator)
  • setting zoom / rotation values by typing them in works now
  • if picture ratio is different than output ratio, the +/- 90 degree buttons flare up, meaning it probably should be rotated
  • all the above picture manipulations can be done in bulk, with convenient button that auto-rotates + auto-fits all pictures
  • background color can be changed to transparent, white, black or chosen from color picker
  • background color can be previewed on canvas
  • transparent background is shown as checkerboard
  • selecting JPEG forces a non-transparent background
  • picture filenames can be appended with values of applied crop settings
  • main menu settings persist in local storage
  • pre-bundled deps avoid cold-start crashes
  • token is now environment-based (no hard-coded tracking)
  • and I hope author doesn't mind, but the default zip name became cropped_{timestamp}.zip.

Very important note: no human was ever involved in writing this code. I was only feeding requirements to GPT 5.2, catching its mistakes and suggesting fixes. By all means, without proper human code review, it should not run in internet-facing production and I do not suggest merging this to main branch. It took dozens of chats and refactors to get to this state, so I'm pretty sure it has a lot of legacy / dead code and leftover artifacts.

But it's a great prototype to show off possible improvements and feature ideas, while still somewhat following KISS principles.

And one can always run this in isolated environment without any risk.

Ah, and I didn't put much thought into the Fixed Size mode, but I took a glimpse and it seems to still work correctly.

The code is pushed to my fork and here's how it looks:

Image

If anyone finds this useful, feel free to expand on the idea.

(my apologies for creating this as an issue, I'm happy to move it to the Discussions section if it's ever enabled)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions