TL;DR: I have created a drag and drop shell script that works on Mac/Linux, which can get the product photo in the right size you want or align with same white margin, with help from a few open source library from Rust .
Have you ever been annoyed that some product photos in your catalog look bigger and some look smaller? Do you want them in the same size?
The processing of 100 1000x1000px images can be done in 96.1s.
./image-optimize.sh 1000 100 96.10s user 27.26s system 269% cpu 45.724 total
How it works
The code simply has 3 steps:
- Detect the bounding box of the object, crop it
- Resize (shrink/enlarge) the cropped image to targeted resolution
- Add the white border back to the image with desired width