eCommerce Image Centering Tool
Center product images using OpenCV multi-method contour detection with threshold fallbacks.
#about
Uses OpenCV cascading thresholding (240, 230, 220, 200, Adaptive Gaussian 21×21, Otsu) with morphological operations (5×5 kernel closing/opening) to detect product subjects.
Centers by finding bounding box of all contours above 1% image area.
Supports batch processing with ZIP export, manual offset adjustments, and configurable output sizes.
Streamlit app
- Platform
- Browser-based (no installation required)
- Input
- Product imagesOutput size and background settings
- Output
- Centered product images (ZIP for batch)
- Category
- E-commerce
Use cases
- Standardising product photos for marketplaces
- Adding consistent padding and backgrounds
- Correcting off-center product shots
- Batch processing catalog images
#features
- Cascading threshold detection (240, 230, 220, 200, then Adaptive and Otsu)
- Morphological cleanup with 5×5 kernels
- Crops to the detected subject plus 5% margin (contours over 1% of image area)
- Output sizes: 600×600, 800×800, 1000×1000, or custom
- Padding 0-30% with hex colour picker
- Manual horizontal/vertical offset (±100px)
- JPEG/WEBP export with batch ZIP download
#how-to-use
- Upload product images (batch supported)
- Select output size and format (JPEG/WEBP)
- Configure padding and background color
- Preview detection with debug visualisation
- Adjust manual offsets if needed
- Download individual images or batch ZIP
#faq
- What kind of product photos does the detection work best on?
- Photos on white or near-white backgrounds. The tool separates subject from background by grayscale thresholding, trying cutoffs of 240, 230, 220 and 200 in turn, then falling back to adaptive Gaussian and Otsu thresholding. If no usable contour is found at any stage, the image is simply resized onto the canvas without recentring, so busy or dark backgrounds may come through unchanged.
- Does the tool crop my image?
- Yes. It crops to the combined bounding box of all detected contours plus a 5% margin, then rescales that crop onto the output canvas. Contours smaller than 1% of the image area are ignored as noise, so tiny detached elements such as faint shadows or small labels can be cropped out.
- Is transparency preserved in the output?
- No. Uploads are converted to RGB on load and output is always JPEG or WEBP on a solid background, chosen with the hex colour picker (white by default). If you upload a transparent PNG, the transparency is discarded before processing, which can also confuse subject detection.
- The subject is centred wrongly. How do I debug it?
- Tick 'Show detection visualization' in the results. It overlays a crosshair on the detected centre and shows the four binary threshold masks side by side, so you can see which thresholding pass fired and whether background clutter was picked up as part of the subject. You can then correct with the manual horizontal and vertical offset sliders (plus or minus 100px in 5px steps).
- How does batch download work?
- The ZIP download only appears when you upload more than one image, and the whole batch is exported in a single format (JPEG or WEBP) chosen at download time. Per-image format selection is available on the individual download buttons.
/contact
Want me to run this for you? I run this tool as a managed service, or build something custom around your data. You get the insights without touching the code.