如何生成人偶对应图案的部件或服装
05/0149 浏览开发心得
基于完整人偶 + AI 图像编辑生成透明底服装/部件的操作指南
本文档记录经过实测验证的生成方法、参数模板和 prompt 编写技巧。
适用于换装系统的服装候选图快速生成。





1. 核心方法将完整人偶图作为 edit_image 的输入参考,prompt 描述目标服装,设置 transparent=true,直接输出透明底的服装/角色图。完整人偶图(原始立绘)
↓ edit_image(transparent=true)
透明底服装/角色图
↓ 用户挑选 + 手动微调
最终服装图层
优势:
- 无需预处理底图(不需要色键填充、不需要裁剪)
- 无需后处理提取(不需要 chroma key、不需要 alpha mask)
- 一次调用即可出结果,适合快速迭代
2. 调用参数模板python
复制edit_image(
image = "人偶模板.png", # 完整人偶图(带体型参考)
prompt = "服装描述...", # 见第 4 节 prompt 编写指南
name = "输出文件名",
aspect_ratio = "2:3", # 竖版人物推荐
target_size = "1024", # 或具体尺寸如 "570x903"
transparent = True, # 🔴 必须!输出透明底
)
参数说明参数值说明image人偶图路径完整人偶立绘,AI 以此为体型参考prompt英文描述服装风格、颜色、材质、细节(详见第 4 节)aspect_ratio"2:3"竖版全身人物最佳比例target_size"1024"输出尺寸,AI 按此和 aspect_ratio 计算实际分辨率transparenttrue必须设置,否则输出白色背景已知特性
- 尺寸偏差:edit_image 输出尺寸可能与 target_size 不完全一致(实测宽度偏差约 +6.3%,如请求 570 返回 606),如需精确尺寸需后期 resize
- 输出内容:AI 会生成包含头发、脸部、身体的完整角色图(不是纯服装图层),服装穿在角色身上
3. 实测成功案例(4 张)以下 4 张图均使用同一人偶输入,效果良好,可作为 prompt 参考模板。共同参数:
- 输入图:人偶_mannequin_v4_20260427091300.png(完整人偶立绘)
- aspect_ratio: "2:3"
- target_size: "1024"
- transparent: true
3.1 r2_qipao_v1 — 红金旗袍输出文件:edited_r2_qipao_v1_20260429101409.pngPrompt:Full body character design of the same anime girl, now wearing a traditional
Chinese qipao/cheongsam dress. The qipao is red with gold floral embroidery
patterns, high collar, side slits showing legs. She maintains the same face,
hairstyle (long dark hair with bangs), and body proportions. Standing pose,
slight smile. The dress fits her figure elegantly. Same art style as the
original character sheet - clean anime illustration style with soft shading.
效果:红色旗袍配金色花卉刺绣,高领开叉,保持原角色面容和体型,整体效果整齐。
3.2 r2_qipao_v2 — 深红旗袍输出文件:edited_r2_qipao_v2_20260429101440.pngPrompt:Full body anime character wearing an elegant traditional Chinese
qipao/cheongsam. The qipao is deep red/crimson with delicate gold floral
embroidery along the edges and collar. High mandarin collar, form-fitting
silhouette, side slit on right leg. The character has the same face and long
dark hair with bangs as the reference. Standing in a graceful pose with hands
at sides. Clean anime illustration style, soft cel-shading, detailed fabric
texture on the qipao. Full body visible from head to feet.
效果:深红/绯红旗袍,领口和边缘精致金色刺绣,贴身剪裁,右侧开叉。
3.3 r2_qipao_v3 — 华丽旗袍输出文件:edited_r2_qipao_v3_20260429101500.pngPrompt:Anime girl full body character design wearing a beautiful traditional Chinese
qipao cheongsam dress. The qipao dress is deep red with ornate gold embroidery
patterns, high mandarin collar, fitted waist, side slit showing right leg. She
has the same face, same long dark hair with bangs, same body proportions as the
reference mannequin image. Clean anime art style, soft shading, elegant
standing pose. The outfit replaces the simple clothes from the reference while
keeping the exact same character appearance and proportions. Transparent
background, full body from head to toe visible.
效果:深红旗袍配华丽金色刺绣,收腰剪裁,在 prompt 中额外强调了保持参考图的体型比例和透明背景。

3.4 r3_lolita — 哥特洛丽塔输出文件:edited_r3_lolita_transparent_test_20260429102538.pngPrompt:Full body anime character design of a cute girl wearing an elegant Gothic
Lolita dress. Black and white frilly dress with lace details, petticoat,
ribbon bow at chest, knee-length skirt with multiple lace layers. She has long
dark hair with bangs, large expressive eyes, youthful face. Standing pose
facing forward. Clean anime illustration style, detailed outfit design.
CHARACTER ON TRANSPARENT BACKGROUND - no background elements, no ground shadow,
just the character floating on empty transparent space. PNG with alpha channel
transparency.
效果:黑白哥特洛丽塔,蕾丝花边、蓬裙衬裙、胸口蝴蝶结,多层蕾丝裙摆。Prompt 末尾用大写强调了透明背景。
4. Prompt 编写指南4.1 有效的 prompt 结构[全身/角色描述] + [服装类型+颜色+材质+细节] + [保持参考图的体型/脸型/发型] + [画风] + [透明背景强调(可选)]
4.2 关键要素要素作用示例全身描述确保输出完整角色“Full body character design”, “Full body visible from head to feet”服装细节精确控制衣服样式“deep red qipao with gold floral embroidery, high mandarin collar, side slit”保持参考维持人偶体型一致性“same face, same hair, same body proportions as the reference”画风统一画面风格“clean anime illustration style, soft cel-shading”透明背景增强透明效果(可选)“CHARACTER ON TRANSPARENT BACKGROUND”transparent=true 参数本身就确保透明底,prompt 中加透明背景描述是额外保险,不加也可以。4.3 Prompt 精度分级阶段精度要求说明探索阶段低 — 简述风格即可快速试验多种方向,挑选最佳定制阶段中 — 描述风格+材质+主要装饰确保输出符合设计意图生产阶段高 — 精确到颜色、材质、装饰位置确保多次生成保持一致性4.4 中文 vs 英文实测中 4 张成功案例均使用英文 prompt。edit_image 对英文 prompt 的理解更稳定,建议优先使用英文。如用中文,建议结构:"全身动漫角色设计,穿着[服装类型]。[颜色+材质+细节描述]。
保持与参考图相同的脸型、发型和身体比例。
干净的动漫插画风格,柔和的赛璐璐着色。"
5. 常见服装类型 Prompt 模板5.1 旗袍/中式
Full body anime character wearing a traditional Chinese qipao/cheongsam.
The qipao is [颜色] with [装饰] embroidery patterns, high mandarin collar,
form-fitting silhouette, side slit on [left/right] leg.
Same face and body proportions as the reference.
Clean anime illustration style, soft shading.
可替换项:
- 颜色:red, deep red/crimson, jade green, navy blue, black
- 装饰:gold floral, silver phoenix, cloud pattern, plum blossom
材质:lace details, frilly edges, ribbon bows, petticoat layers
5.3 校服/制服Full body anime character wearing a [类型] school uniform.
[上衣描述] with [下装描述]. [配件描述].
Same face and hairstyle as the reference.
Clean anime illustration style.
类型:Japanese sailor uniform, blazer-style uniform, summer uniform
5.4 裙装通用Full body anime character wearing a [裙型] dress.
The dress is [颜色], [材质], [领口类型], [袖型], [裙长].
[装饰细节]. Same proportions as the reference.
Clean anime style, detailed outfit design.
裙型:A-line, mermaid, empire waist, fit-and-flare
6. 与其他生成方案的关系本文档记录的是最简方案(直接生成),适合快速探索和手动微调。更精确的方案见 图层拆分与生成规范.md:方案章节适用场景复杂度直接生成(本文档)5.8快速探索、手动微调最低约束模板5.5小部件替换(眼、嘴)低色键抠像5.6精确服装提取高裁剪生成5.7保持轮廓上色中选择建议:需要精确轮廓对齐?
├─ 是 → 见 图层拆分与生成规范.md 的 5.6 或 5.7
└─ 否 → 用本文档的方法(最简最快)
7. 注意事项
- 输出是完整角色图:AI 会生成包含头发、脸部、身体的完整角色,不是纯服装图层。如需纯服装图层,见 图层拆分与生成规范.md 的 5.6/5.7 方案
- 位置/比例可能微调:AI 可能轻微调整角色的位置和比例,不同次生成之间可能有偏差,需用户检查
- 适合批量试错:无预处理无后处理,一次调用即出结果。建议一次生成 3-5 张,从中挑选最满意的
- 手动微调可行:生成的图即使不完美,用户可以在画图软件中微调位置、裁切、调色后使用
- 人偶输入很重要:人偶图的体型、姿态、风格直接影响 AI 生成结果。不同人偶图会产生不同风格的服装




