SuperAPI AI Directory

clothing-extraction

General & other

View repository

Updated 10-15 22:19

About this skill

clothing-extraction — Extract flat-lay product images from any image

Any image → clean flat-lay product image. This is the flat-lay ofreverse operation。

The most common use is to supplement assets: you only have a real-person on-body photo / buyer show / competitor screenshot on hand, but the main image slot needs a clean flat-lay image; or you want to use it as a to-3d、fabric-on-body、flat-lay clean input.


Generation effect example

Input: any image
source-photo.jpg — Real-person street-style photo: light gray knit dress + pearl necklace + tote bag + silver high heels, 480×640

Command actually executed:

dlazy gpt-image-2 \
  --prompt 'Extract the garment worn by the model in this photo and render it as a clean e-commerce flat-lay. Output only the light-grey textured sleeveless knit mini dress with the mock neckline, laid flat and centred, front view, symmetric, fully unoccluded — remove the model, the pearl necklace, the tote bag, the shoes, the fountain and the whole background. Keep the garment 100% faithful: same light-grey colour, same knit texture, same neckline and armhole shape, same waist seam and hem length. Pure white seamless background, even soft studio light, subtle contact shadow. No person, no props, no text.' \
  --images docs/clothing-extraction/source-photo.jpg \
  --size 1024x1024 --quality medium --imageFormat jpeg \
  --save docs/clothing-extraction/example-output.jpg

Output

example-output.jpg — 1024×1024. The model, necklace, tote bag, high heels, and fountain background are all removed, leaving only the dress; laid flat and centered, left-right symmetrical, the stand collar ribbing, armhole shape, waistline seams, and dress length restored according to the original image, with the light gray knit texture preserved.


1. Capability boundaries

Template Description
Full outfit Recognize multiple items on the whole body at once, and output flat-lay images of tops / bottoms / shoes / bags separately
Top front Extract only the top, laid flat from the front
Bottom front Extract only the bottom, laid flat from the front
Custom Describe yourself which item to extract and in what form to output it
Can do Description
Remove people and scene The model, props, and background are all removed
Flatten and symmetrize Output a front-facing, centered, left-right symmetrical flat-lay form
Occlusion completion Parts blocked by arms/bags are inferred and filled in based on symmetry and the regular fit

Do not do: do not change color, pattern, or fit; do not add design elements that are not in the original image out of thin air; do not use it to erase others' brand logos and pass them off as your own products.


2. Input material rules

Before generation, self-check these hard constraints:

  • Size:20KB ~ 15MB
  • Resolution:greater than 400×400
  • Format:jpg / jpeg / png / webp

Input suggestions

Practice Description
✅ The product occupies a large proportion of the frame The larger the proportion, the more accurately the weave and pattern are restored
✅ Front or slightly angled view A pure back view cannot infer the front placket structure
✅ Even lighting Strong shadows will be treated as patterns
⚠️ Occluded areas Parts blocked by arms, bags, or hair areinferred, not restored—when key design positions are blocked, manual confirmation is required
❌ Extremely small proportion / severe blur Only a rough shape can be obtained

3. The four-part structure of the extraction instruction

【段1 · 指定目标】Output only the [唯一要保留的单品,写清品类+颜色+关键特征].
【段2 · 逐项清除】Remove the model, [列出画面里所有其他元素:配饰/包/鞋/道具/背景].
【段3 · 输出形态】Laid flat and centred, front view, symmetric, fully unoccluded.
【段4 · 保真项】Keep the garment 100% faithful: same [颜色], [织法/面料], [领口与袖型], [腰线与下摆长度].

Part 2 must name each item one by one. If you only write remove the background , the necklace, bag, and shoes will be left in the frame as part of the product.

Full outfit = run multiple times, each time segment 1 specifies one item, and segment 2 lists all the rest as objects to be removed. Don't expect to output multiple images at once.


4. Tool invocation

This skill uses dLazy's gpt-image-2(image editing model; the essence of extraction is "keep one target + remove the rest + reconstruct the form", requiring strong instruction following and object-level understanding).

How to invoke

Two equivalent ways to write it, choose one. The unified entry point automatically selects the backend, retries on failure, creates directories and writes to disk, and estimates cost:

# A. 统一入口(推荐):可切任意后端,加 --dry-run 不计费空跑
node scripts/gen.mjs --task clothing-extraction \
  --prompt '<见下方 Prompt 模板>' \
  --images <按下表顺序> \
  --save output/clothing-extraction-<sku>.jpg

# B. 直接用 dLazy CLI(不想引入 Node 依赖时,效果等价)
dlazy gpt-image-2 --prompt '...' --images ... --save output/clothing-extraction.jpg

Parameter conventions (fixed usage for this skill)

Parameter Value Reason
--images [原图] Single-image input
--size 1024x1024(standard square image for flat-lay images) Flat-lay main images are usually square
--quality high Weave and pattern restoration depend entirely on this setting
--imageFormat png(for cleaner blank boundaries) / jpeg png facilitates subsequent secondary cutout
--batch 2 ~ 3 Occlusion completion has randomness
--save docs/clothing-extraction/output-<件名>.jpg One file per item

Command Examples

# basic call: 提取上装
dlazy gpt-image-2 \
  --prompt 'Extract the garment worn by the model and render it as a clean e-commerce flat-lay. Output only the top. Remove the model, accessories, bag, shoes and the whole background. Laid flat and centred, front view, symmetric, fully unoccluded. Keep the garment faithful: same colour, texture, neckline and hem. Pure white seamless background, subtle contact shadow. No person, no props, no text.' \
  --images docs/clothing-extraction/source-photo.jpg \
  --size 1024x1024 --quality high

# complex call: 整套穿搭 → 循环逐件提取
SRC=docs/clothing-extraction/source-photo.jpg
提取() { # $1=件名 $2=目标描述 $3=要清除的其余元素
  dlazy gpt-image-2 \
    --prompt "Extract one garment from this photo and render it as a clean e-commerce flat-lay. Output only $2. Remove the model, $3 and the whole background. Laid flat and centred, front view, symmetric, fully unoccluded; infer any occluded area from symmetry and standard garment construction. Keep it 100% faithful: same colour, same fabric texture, same neckline and armhole shape, same seams and hem length. Pure white seamless background, even soft studio light, subtle contact shadow. No person, no props, no text." \
    --images "$SRC" --size 1024x1024 --quality high --imageFormat png \
    --save "docs/clothing-extraction/output-$1.png"
}
提取 dress 'the light-grey sleeveless knit mini dress with the mock neckline' 'the pearl necklace, the tote bag, the shoes'
提取 bag   'the cream-and-tan canvas tote bag with leather handles'         'the dress, the pearl necklace, the shoes'
提取 shoes 'the pair of silver pointed-toe heels'                            'the dress, the pearl necklace, the tote bag'

# 先估价不真跑
dlazy gpt-image-2 --dry-run --prompt '...' --images a.jpg --size 1024x1024 --quality high

Further reading

What to look up Where to go
Authentication, multi-backend configuration, output structure, error codes references/provider-cli.md
gpt-image-2 All available parameters of references/model-flags.md
All options of the unified entry point node scripts/gen.mjs --help

5. Prompt templates

Extract the garment worn by the model in this photo and render it as a clean e-commerce flat-lay.

Output only [目标单品:品类 + 颜色 + 关键特征], laid flat and centred, front view,
symmetric, fully unoccluded — remove the model, [逐项列出其他元素], and the whole background.

Infer any occluded area from symmetry and standard garment construction.

Keep the garment 100% faithful: same [颜色], same [织法/面料纹理],
same [领口与袖型], same [腰线/接缝与下摆长度].

Pure white seamless background, even soft studio light, subtle contact shadow.
No person, no props, no text.

Correction sentences appended per issue

Issue Append to the end of the prompt
Accessories were not removed Add the missed elements to segment 2, and append Nothing but the garment may remain in the frame.
The output still carries the human body shape The garment must be laid completely flat — no body volume, no invisible mannequin effect.
Left-right asymmetry Mirror-symmetric layout: both sleeves at the same angle and length, collar centred.
The pattern was rearranged Keep the print at its original position and scale relative to the garment body; do not tile or recentre it.
The color is off Sample the colour from the source photo under neutral light; do not brighten or saturate.

6. Execution flow

  1. Look at the original image clearly: Confirm that the target item occupies a large enough proportion, the angle is usable, and key design positions are not blocked.
  2. Write segment 1: The unique target, described so it can be distinguished from everything else in the frame.
  3. Write segment 2: Listallother elements in the frame item by item for removal (model, accessories, bag, shoes, props, background).
  4. Write segment 3 + segment 4: Output form + fidelity items.
  5. A full outfit: Use the loop from section 4, one item at a time.
  6. --quality high start → --batch 2~3 pick an image, write to disk at docs/clothing-extraction/。
  7. Quality check: Whether only the target remains, whether it is completely flattened, whether left and right are symmetric, whether the pattern position and color are accurate;occluded areas must be manually verified。

7. Common issues

Symptom Cause Handling
The necklace/bag is still in the frame Segment 2 did not name it Add each item, and append Nothing but the garment may remain.
The output still has body contours The model understood it as 3D Append laid completely flat — no body volume
The two sleeves are not the same length Symmetry was not required Append a mirror-symmetry sentence
The design of the occluded part is wrong That part was inferred Switch to an original image with less occlusion, or manually correct it
The color is too bright The model automatically brightens Append a color-sampling constraint sentence
Want to produce the whole set at once Produce only one item per run Use the fourth section loop to run item by item

Tips

Visit https://dlazy.com for more information.