Prompt
How do I generate product mockup images from a prompt using an API?
Latest observation
You can generate product mockup images from a text prompt with an image-generation API in a fairly standard flow:
- Describe the product and scene in the prompt
- Call the image generation endpoint
- Download or store the returned image
- Optionally post-process the image in your app
Typical prompt structure
A good mockup prompt usually includes:
- Product type: t-shirt, mug, box, bottle, phone case, tote bag, etc.
- Style: minimal, premium, studio-lit, lifestyle, flat lay
- Background: white seamless, concrete, desk, outdoor
- Branding placement: centered logo, wraparound label, front-facing design
- Render quality: photorealistic, high detail, soft shadows
Example prompt:
"Photorealistic product mockup of a matte black coffee mug on a clean white studio background, centered composition, soft shadow, premium e-commerce style, blank label area, high resolution"
API example
If you’re using an image generation API, the request often looks like this conceptually:
import requests
API_KEY = "your_api_key"
payload = {
"prompt": "Photorealistic product mockup of a black hoodie on a plain white background, studio lighting, front view, high detail",
"size": "1024x1024",
"n": 1
}
response = requests.post(
"https://api.your-image-provider.com/v1/images/generate",
headers={"Authorization": f"Bearer {API_KEY}"},
json=payload
)
data = response.json()
print(data)
The response usually includes either:
- a URL to the generated image, or
- base64-encoded image data
If you want consistent mockups
For product mockups, pure text-to-image can be inconsistent. Better options are:
- Use a reference image of the product
- Use image editing / inpainting to place your design onto an existing blank template
- Use control inputs like a masked area or template image if the API supports it
This is often the best approach for:
- t-shirts
- posters
- packaging
- labels
- phone cases
Good prompt tips
To get better results:
- Be specific about camera angle: front view, top-down, 3/4 angle
- Mention lighting: soft studio light, natural window light
- Mention background: isolated on white, lifestyle setting
- Mention material: glossy ceramic, matte fabric, brushed aluminum
- Avoid overly complex scenes if you want a clean mockup
Example prompts by product
T-shirt
"Premium apparel mockup of a white oversized t-shirt laid flat on a light gray background, subtle fabric texture, front view, realistic shadows, blank chest area for design placement"
Mug
"Photorealistic ceramic mug mockup, white mug with handle facing right, on a clean studio background, soft shadow, blank printable area, e-commerce product photo"
Box packaging
"Luxury packaging mockup of a rectangular cardboard box with minimal branding, white seamless background, soft studio lighting, front angle, high detail"
Important note
If your goal is to place your exact logo or artwork onto the mockup, a generative image model may not reproduce it perfectly. In that case, use:
- a mockup template
- image compositing
- or an API that supports editing with masks / image-to-image
If you want, I can give you:
- a Python example for a specific API,
- a Node.js example,
- or a ready-made prompt template for e-commerce mockups.