Systems Library / AI Capabilities / How to Create AI-Generated Product Mockups
AI Capabilities image generation

How to Create AI-Generated Product Mockups

Generate professional product mockups using AI without photography.

Jay Banlasan

Jay Banlasan

The AI Systems Guy

An ai product mockup generator for ecommerce creates professional lifestyle shots without hiring a photographer or renting a studio. I use these for clients launching new products who need catalog and ad imagery fast. Upload the product, describe the scene, and the AI places it in a realistic environment.

The quality gap between AI mockups and professional photography has nearly closed for digital use cases.

What You Need Before Starting

Step 1: Prepare Product Images

Clean backgrounds make better mockups. Use background removal first:

from rembg import remove
from PIL import Image
import io

def remove_background(input_path, output_path):
    with open(input_path, "rb") as f:
        input_data = f.read()
    output_data = remove(input_data)
    img = Image.open(io.BytesIO(output_data))
    img.save(output_path)
    return output_path

Step 2: Generate Lifestyle Scenes

from openai import OpenAI

client = OpenAI()

SCENE_TEMPLATES = {
    "kitchen": "Modern kitchen countertop, natural morning light, marble surface, subtle plants in background",
    "desk": "Clean office desk, laptop visible, coffee cup, warm afternoon light through window",
    "outdoor": "Outdoor cafe table, natural sunlight, blurred greenery background, wooden surface",
    "studio": "Clean white studio backdrop, professional lighting, soft shadows",
}

def generate_mockup(product_description, scene_type, angle="front"):
    scene = SCENE_TEMPLATES.get(scene_type, SCENE_TEMPLATES["studio"])

    prompt = f"""Professional product photography of {product_description}.
Scene: {scene}
Angle: {angle} view
Style: Commercial product photography, high-end ecommerce quality.
The product is the clear focal point. Sharp focus on product, slightly blurred background.
No text or watermarks."""

    response = client.images.generate(
        model="gpt-image-1",
        prompt=prompt,
        size="1024x1024",
        quality="high"
    )
    return response.data[0].url

Step 3: Batch Generate Multiple Scenes

def generate_product_set(product_description, scenes=None):
    if scenes is None:
        scenes = ["studio", "kitchen", "desk", "outdoor"]

    results = []
    for scene in scenes:
        for angle in ["front", "45-degree"]:
            url = generate_mockup(product_description, scene, angle)
            results.append({
                "scene": scene,
                "angle": angle,
                "url": url
            })
    return results

Step 4: Create Comparison Layouts

from PIL import Image
import requests
from io import BytesIO

def create_comparison_grid(image_urls, output_path, cols=2):
    images = []
    for url in image_urls:
        resp = requests.get(url)
        img = Image.open(BytesIO(resp.content))
        images.append(img)

    width = images[0].width
    height = images[0].height
    rows = (len(images) + cols - 1) // cols
    grid = Image.new("RGB", (width * cols, height * rows), "white")

    for i, img in enumerate(images):
        x = (i % cols) * width
        y = (i // cols) * height
        grid.paste(img, (x, y))

    grid.save(output_path)
    return output_path

Step 5: Organize the Asset Library

def save_mockup(product_id, scene, angle, image_url):
    conn = sqlite3.connect("mockups.db")
    conn.execute("""
        INSERT INTO mockups (product_id, scene, angle, image_url, created_at)
        VALUES (?, ?, ?, ?, datetime('now'))
    """, (product_id, scene, angle, image_url))
    conn.commit()

def get_product_mockups(product_id):
    conn = sqlite3.connect("mockups.db")
    return conn.execute(
        "SELECT * FROM mockups WHERE product_id = ? ORDER BY created_at DESC",
        (product_id,)
    ).fetchall()

What to Build Next

Add seasonal and holiday variants. Generate the same product in Christmas, Valentine's, and Summer scenes for seasonal campaigns. Store them with seasonal tags so you can pull the right set when campaign season arrives.

Related Reading

Want this system built for your business?

Get a free assessment. We will map every system your business needs and show you the ROI.

Get Your Free Assessment

Related Systems