Frequently asked questions about building a Python + Docker product-image pipeline for Magento 2 with rembg (background removal), Pillow (resize / watermark / EXIF), and OpenAI gpt-image-1 (missing-angle generation).
Will this pipeline work on Magento Open Source or only Adobe Commerce?
Both. Everything in the build runs on stock Magento 2.4.7+ Open Source, there’s no Adobe Commerce-specific API used. The observer hooks into catalog_product_save_after, which is identical on both editions. The MessageQueue layer uses Magento’s built-in MessageQueue module (also Open Source). The only Adobe Commerce-only consideration is the Image Editor extension Adobe ships, which you’d disable to avoid duplicate processing. Bottom line: Open Source merchants get the full benefit without paying for Adobe Commerce just for image handling.
Was this helpful?
How does rembg compare to paid services like Photoroom or Remove.bg?
rembg matches Photoroom on ~95% of typical product photos and beats it on cost (zero vs ~9¢ per image) and privacy (offline vs “image leaves your network”). Photoroom is genuinely better on the hard 5%, hair, fur, glass, fine jewellery edges, transparent packaging. For most Magento stores (apparel, FMCG, electronics, home goods), rembg is the right default. The pragmatic pattern is: run rembg first, route the rejected outputs (caught by a simple alpha-edge QA check) to Photoroom as a fallback. You pay Photoroom for ~5% of your volume instead of 100%.
Was this helpful?
Can I run this entirely offline / on-premise?
Yes, if you skip the OpenAI angle-generation step. rembg + Pillow are both fully offline, rembg downloads the U-2-Net model weights once on first use and then runs without network. Pillow is pure stdlib-style processing. The Magento observer + queue worker can run entirely inside your VPN. The only outbound call in the default pipeline is to api.openai.com in step 4, and that’s opt-in per SKU. For regulated industries (pharma, finance, defence) or air-gapped environments, you get the full background-removal + resize + watermark + WebP conversion stack with zero external dependencies. Highly recommended for EU GDPR / Schrems II concerns.
Was this helpful?
What’s the cost per product when using OpenAI for missing angles?
About 12.4¢ per net-new SKU if you generate 3 angles. Breakdown: rembg + Pillow + VM amortised cost is 0.4¢ per image (fixed). OpenAI gpt-image-1 is ~4¢ per generated 1024×1024 angle (as of May 2026), and a typical “fill out the gallery” case is 3 angles. So: 0.4 + 3 × 4 = 12.4¢. For 1,000 net-new SKUs that’s $124 in API costs. Compare that to a photo studio shoot at $80, $200 per SKU, or a designer’s time at $50/hr for 30 min per shot ($25/SKU). Cap with a monthly budget in the worker and only fire on net-new SKUs, never on edits or backfills.
Was this helpful?
How do I avoid breaking already-good product photos?
Three guardrails. (1) Skip on hash match, if the SHA-256 of the input matches a record in your processed-images table, no-op. The worker keeps a small SQLite of every image it’s seen. (2) QA the alpha-channel after rembg, if the cutout has < 5% non-transparent pixels, the background-removal failed catastrophically; bail and keep the original. (3) Per-SKU opt-out attribute, add a skip_image_pipeline product attribute (yes/no). For your professionally-shot SKUs, flip it to yes and the observer skips them. The first two are automatic; the third is for SKUs where you trust the source more than the pipeline.
Was this helpful?
Will this slow down the admin save action?
Not if you use the recommended queue-based wiring. The observer only publishes a message to RabbitMQ (~5ms); the actual image processing happens out-of-band in the worker. The admin save action stays well under 50ms of overhead. The HTTP-webhook variant (option 1 in the integration list) does block the save while the worker processes, that’s fine for tiny stores under 50 products / day, but at any scale you want the queue. If you measure the admin save action taking > 100ms extra after wiring, your observer is doing too much; pull more into the worker.
Was this helpful?
Can it batch-process 10,000+ existing products?
Yes, easily. The CLI command (bin/magento panth:image:process --all) iterates your catalogue and pushes one job per image onto the same queue the live observer uses. A single 4-vCPU worker chews through ~700 images / hour with rembg + Pillow; 10,000 images takes ~14 hours overnight. Cost: about $0.40 in compute. If you spin up 4 parallel workers (cheap on Hetzner), that drops to 3.5 hours. Filters available: --since=YYYY-MM-DD, --category-id=N, --sku-pattern=PREFIX-*, --dry-run. Always dry-run first on a small subset (50 SKUs) to confirm output quality before letting it loose on the full catalogue.
Was this helpful?
Does it preserve product metadata (alt text, file naming) for SEO?
Yes, better than the originals usually. The pipeline rewrites the file path to a hash-based name (e.g. a3b9c2.webp) which prevents CDN cache poisoning, but preserves and re-applies the product’s Magento image_label attribute as the alt text on the rendered <img>. EXIF metadata is intentionally stripped (privacy + smaller files); IPTC + XMP can be re-injected via Pillow if you need them for downstream DAM workflows. For SEO image-search ranking, the new filename + matching alt text + smaller WebP file size is a net positive on every audit we’ve run.
Was this helpful?
Can the pipeline output WebP + AVIF instead of JPEG?
Yes. Pillow ships WebP support out of the box (10.x). AVIF requires the pillow-avif-plugin package, one extra pip install. The standard output we recommend is a 3-file set per image: .avif (q=50,, 55% size), .webp (q=80,, 50% size), .jpg (q=88, legacy fallback). Your storefront then emits a <picture> tag with all three sources; browsers pick the best they support. AVIF is ~25% smaller than WebP and ~60% smaller than JPEG at matched quality. Combined Core Web Vitals LCP win on a typical PDP: 400-700ms.
Was this helpful?
How do I handle multi-store / multi-locale watermarking?
The worker receives the store-view code in the job payload and forks the output at step 3 (Pillow). For each enabled store-view, it generates a separate output file under pub/media/catalog/product/_storeview/<code>. Magento’s media path resolver then serves the right one based on the active store. Common patterns: UK store gets a small “FCA-regulated” corner stamp on financial products; DE store gets “UVP” on price-comparison overlays; wholesale store-view gets no watermark at all. Multi-region currency overlays (showing £ on UK store, € on EU store) work the same way. Storage cost multiplies by N store-views; if you have 12 store-views and 50k SKUs, plan for ~3GB of extra disk.
Was this helpful?
What’s the bottleneck, rembg, Pillow, or OpenAI?
OpenAI by a country mile, and only when it’s in the loop. rembg is ~2-4 sec on CPU (sub-second on GPU). Pillow ops are ~200ms. OpenAI gpt-image-1 is 8-15 sec per generated angle plus rate-limit waits. If you fire 3 angles per SKU, you’re looking at 30-50 sec per SKU end-to-end vs ~3 sec for the self-host-only path. For high-volume real-time use, the pattern is: process and publish the cleaned hero immediately (3 sec, instant PDP improvement); enqueue the AI angle-gen as a low-priority follow-up that completes minutes later. Don’t let the OpenAI step block the “PDP looks better” visible win.
Was this helpful?
Is using AI-generated product angles legal / ethical?
Generally yes, with caveats. OpenAI’s ToS (May 2026) assigns you commercial rights to outputs of images.edit(), provided your input image was something you owned or had licence for. Where it gets risky: (1) Misrepresentation, if the AI generates an angle that shows a feature the actual product doesn’t have, you’ve created a misleading product image. Always human-QA before publish. (2) Disclosure, the EU AI Act (in force 2026) requires labelling AI-generated content in some commercial contexts; check your jurisdiction. (3) Trade-marked elements, if the AI bakes in a competitor’s logo or a trademarked person, you have an IP problem. The pragmatic rule: AI angle-gen is a productivity tool for “same product, different angle” not for creating fictional product features.
Was this helpful?
Request a quote
I'll reply within 2-4 hours business with a written quote and timeline.