DEV Community

Cover image for Turning a flat-lay photo into an on-model shot with two prompt segments
xiaodong Zhang
xiaodong Zhang

Posted on

Turning a flat-lay photo into an on-model shot with two prompt segments

If you sell clothing online you need on-model photography, and on-model photography means booking a model, renting a space, and waiting on retouching. Three to five days per round.

flat-lay — from an MIT-licensed skill library I have been working through — collapses that to about 60 seconds. You give it a flat-lay garment photo and a pose reference, and it dresses the person in the garment.

The interesting part for a developer audience is not that it works. It is that the prompt has a rigid two-part structure, and once you see it you start recognising the same shape in a lot of image-editing tasks.


The structure

Every call is built from two things that pull in opposite directions:

Preserve — everything about the garment must survive unchanged:

Preserve 100% fidelity of the garment color, knit texture, oversized
drop-shoulder silhouette, collar, cuff and hem details, and the placement
of the woven label.
Enter fullscreen mode Exit fullscreen mode

Adopt — everything about the scene must come from the reference:

Keep the exact pose, camera angle, crop, body proportions, lighting and
background from image 2.
Enter fullscreen mode Exit fullscreen mode

That is the whole skill. One clause locks the product, the other locks the context, and the model resolves the middle.

Full call:

dlazy gpt-image-2 \
  --prompt "E-commerce on-model product photography. Image 1 is a flat-lay of
   an olive green cable-knit crewneck sweater with a chunky diamond cable
   pattern, ribbed collar and cuffs, and a woven label on the left cuff.
   Image 2 is the pose and scene reference. Dress the model from image 2 in
   the garment from image 1, replacing the clothing they currently wear.
   Preserve 100% fidelity of ... Keep the exact pose, camera angle, crop ...
   Photorealistic catalog styling, sharp fabric detail, soft natural light,
   no text or watermark." \
  --images garment-flatlay.jpg pose-reference.jpg \
  --size 1024x1536 --quality high --imageFormat jpeg --batch 3 \
  --save out/SKU001.jpg
Enter fullscreen mode Exit fullscreen mode

Model is gpt-image-2 — multi-image editing, up to 5 reference images, 60 credits at --quality high.


--images order is load-bearing

This tripped me up and it is worth flagging because the failure is silent.

The positional order of --images maps to image 1, image 2, image 3 in the prompt text. There is no key, no label, no validation. Swap the order and the model dresses your flat-lay in a person.

# single garment
--images garment.jpg reference.jpg          # image 1, image 2

# full look
--images top.jpg bottom.jpg reference.jpg   # image 1, image 2, image 3
Enter fullscreen mode Exit fullscreen mode

The convention is: product first, reference last. Keep it consistent across a project or your prompt text quietly stops matching your arguments.


Specificity is the whole quality lever

The single highest-leverage thing in this prompt is the garment description, and the gap between lazy and specific is not subtle.

# weak
a green sweater

# strong
an olive green cable-knit crewneck sweater with a chunky diamond cable
pattern, oversized drop-shoulder fit, ribbed collar and cuffs, and a
woven label on the left cuff
Enter fullscreen mode Exit fullscreen mode

Same model, same reference, same parameters. Materially different output. Every additional structural noun — drop-shoulder, ribbed, diamond cable — is a constraint the model can hold onto rather than invent.

English is recommended over Chinese for the garment section specifically. Scene and mood work in either.


Symptom-driven add-ons

What I found genuinely well-designed is that the failure modes are enumerated, and each maps to a specific sentence you append. Not "try rewording it" — an actual mapping.

Symptom Append
Colour drifted Match the garment color to image 1 exactly — same hue, saturation and brightness
Texture went mushy visible knit loops / weave grain / pile direction, fiber sheen, soft fold shadows
Broken hands, warped collar five fingers per hand, symmetric shoulders, no extra limbs
Face or background changed Change only the garment region + itemise what must stay identical

That last one is the important one. Because the garment occupies most of the frame in this skill, the model tends to treat the whole image as editable. Region-locking is cheap and prevents the most annoying class of failure — a perfect sweater on a subtly different person.


Input constraints worth validating before you spend credits

  • 20KB–15MB, above 400×400, jpg/jpeg/png/webp
  • Reject: garments occluded by arms or props, images containing both a top and a bottom (split into two files and use full-look mode), anything blurry or blown out

That second one bit me. An "outfit" photo with a top and trousers in one frame is not one input — the model picks one or blends them. Two files, three images total, roll-call each.


Reference selection drives everything downstream

The reference image controls pose, camera angle, crop, lighting and background. Choosing badly is not recoverable in post.

  • Fidelity first → frontal standing pose, plain background, crop matched to the category (half-body for tops, full-body for dresses)
  • Mood first → street or interior scenes, at the cost of some fit drift
  • Batch consistency → freeze one reference and one model, swap only the garment

That last mode is what makes this usable at scale. Dozens of SKUs against a single locked reference produce a visually coherent catalogue. Specifying a locked model adds roughly a minute per call.


Parameters

Flag Value Why
--size 1024x1536 3:4 vertical, the e-commerce standard. 1024x1024 for detail shots
--quality high medium visibly softens knit texture
--imageFormat jpeg
--batch 2–4 Run-to-run variance is real; generate a few and pick
--dry-run Prints parameters and a credit estimate without executing

Always --dry-run first. At 60 credits per image, a typo in a batch loop is expensive.


QC before you ship

Four things to check on every output: colour drift, texture blur, print displacement, hand and collar artifacts.

The library has a dedicated skill for this (detect-task, ~3 credits per image) that checks eight fixed dimensions and hands back an English fix line you can append to the original prompt. I have written about it separately — including the part where it caught a hand defect in an image I had already published as an example.

Which is the real argument for automated QC. Not that the model is unreliable — it is that you stop seeing your own output after the third look.


MIT licensed, 19 skills, works with Claude Code / Codex / Cursor:

npx skills add https://github.com/dlazyai/ecommerce-skills --all
Enter fullscreen mode Exit fullscreen mode

Repo: github.com/dlazyai/ecommerce-skills

Top comments (0)