AI Product Image Generation for E-Commerce

We design and deploy artificial intelligence systems: from prototype to production-ready solutions. Our team combines expertise in machine learning, data engineering and MLOps to make AI work not in the lab, but in real business.
Showing 1 of 1 servicesAll 1566 services
AI Product Image Generation for E-Commerce
Medium
~5 business days
FAQ
AI Development Areas
AI Solution Development Stages
Latest works
  • image_website-b2b-advance_0.png
    B2B ADVANCE company website development
    1212
  • image_web-applications_feedme_466_0.webp
    Development of a web application for FEEDME
    1161
  • image_websites_belfingroup_462_0.webp
    Website development for BELFINGROUP
    852
  • image_ecommerce_furnoro_435_0.webp
    Development of an online store for the company FURNORO
    1041
  • image_logo-advance_0.png
    B2B Advance company logo design
    561
  • image_crm_enviok_479_0.webp
    Development of a web application for Enviok
    822

AI E-commerce Product Image Generation

AI product image generation reduces photography session costs: background removal, background replacement, lifestyle scene generation with product, color/material variations without reshoot. Typical savings: $50–200 per product vs. studio shoot.

Background Removal + Generation

from rembg import remove, new_session
from PIL import Image
from diffusers import StableDiffusionXLInpaintPipeline
import torch
import io
import numpy as np

class ProductImageGenerator:
    def __init__(self):
        self.bg_remover = new_session("isnet-general-use")
        self.pipe = StableDiffusionXLInpaintPipeline.from_pretrained(
            "diffusers/stable-diffusion-xl-1.0-inpainting-0.1",
            torch_dtype=torch.float16
        ).to("cuda")

    def remove_background(self, product_image: bytes) -> tuple[bytes, bytes]:
        """Return (image without background, background mask)"""
        result = remove(product_image, session=self.bg_remover)
        img_rgba = Image.open(io.BytesIO(result)).convert("RGBA")

        # Mask: white = background (for inpainting), black = product
        r, g, b, a = img_rgba.split()
        mask = Image.fromarray(255 - np.array(a))  # invert alpha

        img_rgb = Image.new("RGB", img_rgba.size, (255, 255, 255))
        img_rgb.paste(img_rgba, mask=img_rgba.split()[3])

        img_buf = io.BytesIO()
        img_rgb.save(img_buf, format="PNG")

        mask_buf = io.BytesIO()
        mask.save(mask_buf, format="PNG")

        return img_buf.getvalue(), mask_buf.getvalue()

    def place_on_background(self, product_image: bytes, background_prompt: str, steps: int = 30) -> bytes:
        product_bytes, mask_bytes = self.remove_background(product_image)

        result = self.pipe(
            prompt=background_prompt,
            image=Image.open(io.BytesIO(product_bytes)),
            mask_image=Image.open(io.BytesIO(mask_bytes)),
            num_inference_steps=steps,
            guidance_scale=9.0,
            strength=0.99
        ).images[0]

        buf = io.BytesIO()
        result.save(buf, format="PNG")
        return buf.getvalue()

Lifestyle Scenes Generation

Category-based prompts: electronics (desk setups), clothing (street style), food (rustic tables), cosmetics (luxury aesthetics). API generates 4-6 product scene variations per image. Integration with product database: SKU → category → scene prompts.

Timeline: setup pipeline — 1–2 days. Full platform with bulk processing, API, front-end — 2–3 weeks.