Studio photography of a single product costs hundreds of rubles, and for a catalog of 10,000 items, the budget becomes astronomical. Meanwhile, marketplace image requirements keep changing: Wildberries asks for 1000×1000 px, Amazon demands 2000×2000 with 85% padding, Ozon requires a white background without shadows. Reshooting each season or for each platform is unjustifiable. Our AI pipeline automates product image generation, saving up to 80% of the budget and accelerating the process to 2–5 seconds per frame. We use a combination of Stable Diffusion XL, ControlNet, and IP-Adapter to precisely preserve product shape and texture, and LoRA fine-tuning (rank 16) adapts the model to your catalog's unique features.
A typical problem is image incompatibility across platforms: Ozon requires a strict white background, while lifestyle scenes need creative environments. We solve this with a unified algorithm that feeds the appropriate background during generation based on the target platform. The approach requires no manual rework and scales across the entire catalog.
How AI Generates Product Images
At the core is Stable Diffusion XL with inpainting and ControlNet. The model is fine-tuned on your catalog using LoRA (rank 16) to preserve unique product attributes — texture, logo, shape. The entire pipeline runs on PyTorch with Triton Inference Server for low latency. We use dynamic prompts based on product category: for electronics — "modern minimalist desk setup", for clothing — "urban street style", for cosmetics — "marble surface with flowers". This ensures background relevance and boosts click-through rates on marketplaces. Without fine-tuning, the model hallucinates — distorts shapes or overlays foreign objects. LoRA with rank 16 solves this, preserving detail.
Background Removal + Re-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]:
"""Returns (image without background, background mask)"""
result = remove(product_image, session=self.bg_remover)
img_rgba = Image.open(io.BytesIO(result)).convert("RGBA")
r, g, b, a = img_rgba.split()
mask = Image.fromarray(255 - np.array(a))
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 Scene Generation
PRODUCT_SCENE_PROMPTS = {
"electronics": [
"modern minimalist desk setup, natural light, laptop nearby, bokeh background",
"cozy home office, wooden desk, plants, warm ambient lighting",
],
"clothing": [
"fashion editorial, urban street style, natural daylight",
"lifestyle shot, outdoor park, casual summer day",
],
"food": [
"rustic wooden table, natural light, herbs nearby, shallow depth of field",
"modern kitchen counter, marble surface, fresh ingredients",
],
"cosmetics": [
"marble surface with flowers, soft pink background, luxury aesthetic",
"bathroom counter, morning light, clean minimalist style",
]
}
async def generate_product_scenes(
product_image: bytes,
product_category: str,
num_variants: int = 4
) -> list[bytes]:
prompts = PRODUCT_SCENE_PROMPTS.get(product_category, ["professional studio, white background"])
results = []
for prompt in prompts[:num_variants]:
result = product_gen.place_on_background(
product_image,
f"product photography, {prompt}, high quality, 8k"
)
results.append(result)
return results
Color Variant Generation
async def generate_color_variants(
product_image: bytes,
colors: list[str],
product_mask: bytes
) -> dict[str, bytes]:
"""Changes product color via inpainting with mask"""
results = {}
for color in colors:
from diffusers import StableDiffusionXLInpaintPipeline
result = pipe(
prompt=f"same product shape, {color} color, same material texture, product photography",
image=Image.open(io.BytesIO(product_image)),
mask_image=Image.open(io.BytesIO(product_mask)),
strength=0.6,
guidance_scale=10.0
).images[0]
buf = io.BytesIO()
result.save(buf, format="PNG")
results[color] = buf.getvalue()
return results
Why AI Is Cheaper Than Studio Photography
| Criteria | Studio Photography | Our AI Pipeline |
|---|---|---|
| Cost per item | High | Low |
| Time for 1000 items | Weeks | Hours |
| Color/material variants | Requires new shoot | Generated in seconds |
| Scaling | Linear cost growth | Nearly free |
Budget savings reach up to 80%, and the project payback period is 2–3 months for catalogs with over 1000 items. For example, for a retailer with a catalog of several thousand products, we generated tens of thousands of images (main + lifestyle + color variants) in a few days. Studio photography would have taken a month and cost orders of magnitude more.
Marketplace Image Requirements
| Platform | Size | Format | Background | Padding |
|---|---|---|---|---|
| Wildberries | 1000×1000 | JPG | White | None |
| Ozon | 1000×1000 | JPG | White | None |
| Amazon | 2000×2000 | JPG | White | 85% |
| Shopify | 2048×2048 | WebP | Any | None |
How We Implement the Solution
- Catalog audit — analyze current photos, marketplace requirements, data volume.
- Pipeline setup — fine-tune LoRA model on 20–50 of your products, select prompts.
- Batch processing — generate all images (backgrounds, scenes, variants).
- Optimization — conform to marketplace requirements (size, format, background).
- Integration — connect API to your CMS or upload via FTP.
- Quality control — automated validation plus spot manual checks.
Typical timelines: catalog up to 5,000 items — 1–2 weeks; up to 50,000 — 3–4 weeks.
What's Included in Our Project
- Pipeline and API documentation.
- Training your team to work with the model.
- 1 month of post-launch support.
- Guaranteed stable quality — fixed metrics and SLA.
Our team has several years of experience in computer vision and generative models, with over 50 e-commerce projects. We use certified open-source solutions and guarantee reproducible results.
Common Implementation Mistakes
- Using one model for all categories without fine-tuning — loss of detail.
- Ignoring marketplace requirements for padding and color profile.
- No A/B testing of AI photos vs studio photos — conversion can drop if the model hallucinates.
We set metrics for each case and conduct comparative analysis before launch. Order a pilot on 100 items — see the quality and speed for yourself. Contact us for a detailed audit of your catalog. Get a consultation on integrating AI generation into your business.







