image-tryon
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
Chineseimage-tryon
image-tryon
Use this skill for all virtual try-on requests on Starchild.
Covers: clothing try-on, accessory try-on, hairstyle preview, makeup preview, glasses try-on, hat try-on, shoes try-on, watch try-on.
Core principle: call the provided script. Do not re-implement proxy/billing plumbing.
Key difference from image-edit: try-on always requires two images — a person photo and a garment/item photo.
在Starchild上处理所有虚拟试穿请求时使用此技能。
涵盖:服装试穿、配饰试穿、发型预览、妆容预览、眼镜试穿、帽子试穿、鞋子试穿、手表试穿。
核心原则: 调用提供的脚本。请勿重新实现代理/计费相关的底层逻辑。
与image-edit的关键区别: 试穿始终需要两张图片——人物照片和服饰/物品照片。
1. Quick start — clothing try-on (most common)
1. 快速入门——服装试穿(最常见场景)
python
exec(open('skills/image-tryon/try_on.py').read())
result = try_on(
person_path="uploads/person.jpg",
garment_path="uploads/dress.jpg",
category="clothing",
)python
exec(open('skills/image-tryon/try_on.py').read())
result = try_on(
person_path="uploads/person.jpg",
garment_path="uploads/dress.jpg",
category="clothing",
)result -> {"success": True, "images": [{"local_path": "output/images/..."}], ...}
result -> {"success": True, "images": [{"local_path": "output/images/..."}], ...}
The script reads both local files, base64-encodes them, and sends them to fal.ai as data URIs — no manual URL publishing needed.
该脚本会读取两个本地文件,将其进行base64编码,并以数据URI的形式发送至fal.ai——无需手动发布URL。2. Quick start — URL inputs
2. 快速入门——URL输入
python
exec(open('skills/image-tryon/try_on.py').read())
result = try_on(
person_url="https://example.com/person.jpg",
garment_url="https://example.com/jacket.jpg",
category="clothing",
)python
exec(open('skills/image-tryon/try_on.py').read())
result = try_on(
person_url="https://example.com/person.jpg",
garment_url="https://example.com/jacket.jpg",
category="clothing",
)3. Quick start — glasses try-on
3. 快速入门——眼镜试穿
python
exec(open('skills/image-tryon/try_on.py').read())
result = try_on(
person_path="uploads/face.jpg",
garment_path="uploads/sunglasses.jpg",
category="glasses",
)python
exec(open('skills/image-tryon/try_on.py').read())
result = try_on(
person_path="uploads/face.jpg",
garment_path="uploads/sunglasses.jpg",
category="glasses",
)Delivering the result to the user — IMPORTANT
将结果交付给用户——重要提示
Never hand the user the raw fal.media URL. fal serves files with restrictive CSP headers. The only reliable delivery path is the already-downloaded local file:
- Use each image's (e.g.
local_path) — the script always downloads on success.output/images/xxx.png - Tell the user the files are saved to and viewable in the workspace file panel.
output/images/ - On Web channel, embed inline so the user can preview in chat:
markdown
 - On Telegram / WeChat: send via or
send_to_telegram(file_path="output/images/...", message_type="image").send_to_wechat(file_path="output/images/...", message_type="image")
绝不能直接将原始fal.media URL交给用户。 fal提供的文件带有严格的CSP头部限制。唯一可靠的交付方式是使用已下载的本地文件:
- 使用每张图片的(例如
local_path)——脚本在执行成功后总会自动下载文件。output/images/xxx.png - 告知用户文件已保存至,可在工作区文件面板中查看。
output/images/ - 在Web渠道中,可将图片内嵌到聊天中供用户预览:
markdown
 - 在Telegram/微信渠道:通过或
send_to_telegram(file_path="output/images/...", message_type="image")发送图片。send_to_wechat(file_path="output/images/...", message_type="image")
4. Parameters
4. 参数说明
| Parameter | Required | Default | Description |
|---|---|---|---|
| yes* | — | Local workspace file path to the person's photo |
| yes* | — | Public HTTPS URL of the person's photo |
| yes* | — | Local workspace file path to the garment/item photo |
| yes* | — | Public HTTPS URL of the garment/item photo |
| no | | Try-on category key (see §5) |
| no | | Custom prompt — overrides category default when set |
| no | | Model: |
| no | | Output ratio: |
Image input rules:
- Person image: provide OR
person_path(one is required).person_url - Garment/item image: provide OR
garment_path(one is required).garment_url - If both path and URL are given for the same image, path takes priority.
- Both images are required — try-on cannot work with only one image.
Prompt priority: (full override) > default prompt.
promptcategory| 参数 | 是否必填 | 默认值 | 描述 |
|---|---|---|---|
| 是* | — | 人物照片在工作区的本地文件路径 |
| 是* | — | 人物照片的公开HTTPS URL |
| 是* | — | 服饰/物品照片在工作区的本地文件路径 |
| 是* | — | 服饰/物品照片的公开HTTPS URL |
| 否 | | 试穿类别标识(参见第5节) |
| 否 | | 自定义提示词——设置后会覆盖类别的默认提示词 |
| 否 | | 模型选项: |
| 否 | | 输出比例: |
图片输入规则:
- 人物图片: 需提供或
person_path(二选一即可)。person_url - 服饰/物品图片: 需提供或
garment_path(二选一即可)。garment_url - 如果同时提供了同一图片的路径和URL,路径将优先生效。
- 必须同时提供两张图片——仅一张图片无法完成试穿。
提示词优先级: (完全覆盖) > 类别默认提示词。
prompt5. Try-on categories
5. 试穿类别
Intent recognition — what the user says → which category to use
意图识别——用户表述对应类别
| User says | Category | Key |
|---|---|---|
| "try on this dress/shirt/jacket/outfit" | Clothing | |
| "put this necklace/scarf/bag on me" | Accessory | |
| "show me with this hairstyle/hair color" | Hairstyle | |
| "apply this makeup/lipstick look" | Makeup | |
| "try on these glasses/sunglasses" | Glasses | |
| "put this hat/cap/beanie on me" | Hat | |
| "try on these shoes/sneakers/boots" | Shoes | |
| "put this watch on my wrist" | Watch | |
| 用户表述 | 类别 | 标识 |
|---|---|---|
| "试穿这条裙子/衬衫/夹克/这套衣服" | 服装 | |
| "给我戴上这条项链/围巾/这个包" | 配饰 | |
| "展示我留这个发型/染这个发色的样子" | 发型 | |
| "帮我化这个妆容/涂这款口红" | 妆容 | |
| "试戴这副眼镜/墨镜" | 眼镜 | |
| "给我戴上这顶帽子/棒球帽/针织帽" | 帽子 | |
| "试穿这双鞋/运动鞋/靴子" | 鞋子 | |
| "给我戴上这块手表" | 手表 | |
Category details
类别详情
| Category | Key | Best for | Photo requirements |
|---|---|---|---|
| Clothing | | Shirts, dresses, jackets, pants, coats, full outfits | Full body or upper body person photo |
| Accessory | | Scarves, bags, belts, jewelry, necklaces, earrings | Relevant body area visible |
| Hairstyle | | Haircuts, hair colors, styling changes | Clear face/head photo |
| Makeup | | Lipstick, eyeshadow, foundation, blush, full looks | Clear face close-up |
| Glasses | | Prescription glasses, sunglasses, reading glasses | Clear face photo, front-facing |
| Hat | | Caps, beanies, fedoras, sun hats, helmets | Head and shoulders visible |
| Shoes | | Sneakers, heels, boots, sandals, loafers | Full body or lower body photo |
| Watch | | Analog, smartwatches, luxury watches | Wrist/arm visible |
| 类别 | 标识 | 适用场景 | 照片要求 |
|---|---|---|---|
| 服装 | | 衬衫、连衣裙、夹克、裤子、大衣、整套穿搭 | 全身或上半身人物照片 |
| 配饰 | | 围巾、包、腰带、珠宝、项链、耳环 | 需露出相关身体部位 |
| 发型 | | 发型、发色、造型变化 | 清晰的面部/头部照片 |
| 妆容 | | 口红、眼影、粉底、腮红、完整妆容 | 清晰的面部特写 |
| 眼镜 | | 近视眼镜、墨镜、老花镜 | 清晰的正面面部照片 |
| 帽子 | | 棒球帽、针织帽、礼帽、遮阳帽、头盔 | 需露出头部和肩膀 |
| 鞋子 | | 运动鞋、高跟鞋、靴子、凉鞋、乐福鞋 | 全身或下半身照片 |
| 手表 | | 机械表、智能手表、奢侈品手表 | 需露出手腕/手臂 |
6. Model selection guide
6. 模型选择指南
| Model | Key | Speed | Quality | Best for |
|---|---|---|---|---|
| NanoPro | | ~25s | Good | Default for all requests. Fast iteration. |
| GPT Image 2 | | ~150s | Best | When user explicitly asks for "highest quality" or "best quality". |
Decision rules:
- Default: always use unless the user explicitly requests higher quality.
nanopro - Use when: user says "highest quality", "best quality", "premium", or the result needs to be photorealistic for professional use.
gpt - Use when: user wants fast results, is trying multiple items, or iterating on looks.
nanopro
python
undefined| 模型 | 标识 | 速度 | 质量 | 适用场景 |
|---|---|---|---|---|
| NanoPro | | ~25秒 | 良好 | 所有请求的默认选项,适合快速迭代。 |
| GPT Image 2 | | ~150秒 | 最佳 | 当用户明确要求“最高质量”或“最佳效果”时使用。 |
决策规则:
- 默认设置: 除非用户明确要求更高质量,否则始终使用。
nanopro - 使用的场景: 用户提及“最高质量”、“最佳效果”、“ premium”,或结果需要达到专业级照片真实度时。
gpt - 使用的场景: 用户需要快速结果、尝试多款物品,或迭代不同造型时。
nanopro
python
undefinedDefault (fast)
默认(快速)
result = try_on(person_path="me.jpg", garment_path="dress.jpg", category="clothing")
result = try_on(person_path="me.jpg", garment_path="dress.jpg", category="clothing")
High quality (user requested)
高质量(用户要求)
result = try_on(person_path="me.jpg", garment_path="dress.jpg", category="clothing", model="gpt")
---result = try_on(person_path="me.jpg", garment_path="dress.jpg", category="clothing", model="gpt")
---7. Usage examples by category
7. 分场景使用示例
Clothing try-on
服装试穿
python
exec(open('skills/image-tryon/try_on.py').read())
result = try_on(
person_path="uploads/person_fullbody.jpg",
garment_path="uploads/summer_dress.jpg",
category="clothing",
)python
exec(open('skills/image-tryon/try_on.py').read())
result = try_on(
person_path="uploads/person_fullbody.jpg",
garment_path="uploads/summer_dress.jpg",
category="clothing",
)Accessory try-on
配饰试穿
python
exec(open('skills/image-tryon/try_on.py').read())
result = try_on(
person_path="uploads/portrait.jpg",
garment_path="uploads/gold_necklace.jpg",
category="accessory",
)python
exec(open('skills/image-tryon/try_on.py').read())
result = try_on(
person_path="uploads/portrait.jpg",
garment_path="uploads/gold_necklace.jpg",
category="accessory",
)Hairstyle preview
发型预览
python
exec(open('skills/image-tryon/try_on.py').read())
result = try_on(
person_path="uploads/face.jpg",
garment_path="uploads/bob_hairstyle.jpg",
category="hairstyle",
)python
exec(open('skills/image-tryon/try_on.py').read())
result = try_on(
person_path="uploads/face.jpg",
garment_path="uploads/bob_hairstyle.jpg",
category="hairstyle",
)Makeup preview
妆容预览
python
exec(open('skills/image-tryon/try_on.py').read())
result = try_on(
person_path="uploads/face_closeup.jpg",
garment_path="uploads/evening_makeup.jpg",
category="makeup",
)python
exec(open('skills/image-tryon/try_on.py').read())
result = try_on(
person_path="uploads/face_closeup.jpg",
garment_path="uploads/evening_makeup.jpg",
category="makeup",
)Glasses try-on
眼镜试穿
python
exec(open('skills/image-tryon/try_on.py').read())
result = try_on(
person_path="uploads/face_front.jpg",
garment_path="uploads/aviator_sunglasses.jpg",
category="glasses",
)python
exec(open('skills/image-tryon/try_on.py').read())
result = try_on(
person_path="uploads/face_front.jpg",
garment_path="uploads/aviator_sunglasses.jpg",
category="glasses",
)Hat try-on
帽子试穿
python
exec(open('skills/image-tryon/try_on.py').read())
result = try_on(
person_path="uploads/head_shoulders.jpg",
garment_path="uploads/fedora_hat.jpg",
category="hat",
)python
exec(open('skills/image-tryon/try_on.py').read())
result = try_on(
person_path="uploads/head_shoulders.jpg",
garment_path="uploads/fedora_hat.jpg",
category="hat",
)Shoes try-on
鞋子试穿
python
exec(open('skills/image-tryon/try_on.py').read())
result = try_on(
person_path="uploads/person_fullbody.jpg",
garment_path="uploads/white_sneakers.jpg",
category="shoes",
)python
exec(open('skills/image-tryon/try_on.py').read())
result = try_on(
person_path="uploads/person_fullbody.jpg",
garment_path="uploads/white_sneakers.jpg",
category="shoes",
)Watch try-on
手表试穿
python
exec(open('skills/image-tryon/try_on.py').read())
result = try_on(
person_path="uploads/wrist_photo.jpg",
garment_path="uploads/luxury_watch.jpg",
category="watch",
)python
exec(open('skills/image-tryon/try_on.py').read())
result = try_on(
person_path="uploads/wrist_photo.jpg",
garment_path="uploads/luxury_watch.jpg",
category="watch",
)Custom prompt (override default)
自定义提示词(覆盖默认)
python
exec(open('skills/image-tryon/try_on.py').read())
result = try_on(
person_path="uploads/person.jpg",
garment_path="uploads/vintage_jacket.jpg",
category="clothing",
prompt="The person is wearing the vintage leather jacket from the second image, styled with a casual street fashion look. Keep the person's face and body exactly the same. Add realistic leather texture and natural draping.",
)python
exec(open('skills/image-tryon/try_on.py').read())
result = try_on(
person_path="uploads/person.jpg",
garment_path="uploads/vintage_jacket.jpg",
category="clothing",
prompt="The person is wearing the vintage leather jacket from the second image, styled with a casual street fashion look. Keep the person's face and body exactly the same. Add realistic leather texture and natural draping.",
)Different aspect ratio
自定义比例
python
exec(open('skills/image-tryon/try_on.py').read())
result = try_on(
person_path="uploads/person.jpg",
garment_path="uploads/outfit.jpg",
category="clothing",
aspect_ratio="9:16", # Full-length portrait
)python
exec(open('skills/image-tryon/try_on.py').read())
result = try_on(
person_path="uploads/person.jpg",
garment_path="uploads/outfit.jpg",
category="clothing",
aspect_ratio="9:16", # 全身竖版
)8. Photo requirements — best practices
8. 照片要求——最佳实践
Person photo guidelines
人物照片指南
| Category | Recommended photo type | Tips |
|---|---|---|
| Clothing | Full body, front-facing | Arms slightly away from body, neutral pose |
| Accessory | Relevant body area visible | Good lighting on the area where accessory goes |
| Hairstyle | Clear head/face, front or 3/4 view | Hair pulled back or current style clearly visible |
| Makeup | Face close-up, front-facing | Clean face, good even lighting, no heavy makeup |
| Glasses | Face front-facing, eyes visible | No existing glasses, clear eye area |
| Hat | Head and shoulders, front-facing | No existing hat, hair visible |
| Shoes | Full body or legs/feet visible | Standing pose, current shoes visible |
| Watch | Wrist/forearm visible | Bare wrist or current watch visible |
| 类别 | 推荐照片类型 | 小贴士 |
|---|---|---|
| 服装 | 全身正面照 | 手臂略离身体,姿势自然 |
| 配饰 | 露出相关身体部位 | 配饰佩戴区域光线良好 |
| 发型 | 清晰的头部/面部照片,正面或3/4侧面 | 头发向后梳或当前发型清晰可见 |
| 妆容 | 面部特写正面照 | 面部干净,光线均匀,无浓妆 |
| 眼镜 | 正面面部照,眼睛清晰可见 | 未佩戴眼镜,眼部区域无遮挡 |
| 帽子 | 头部和肩膀正面照 | 未佩戴帽子,头发可见 |
| 鞋子 | 全身或腿脚照片 | 站立姿势,当前鞋子可见 |
| 手表 | 手腕/小臂照片 | 手腕裸露或当前手表可见 |
General photo quality rules
通用照片质量规则
- Lighting: well-lit, even lighting works best. Avoid harsh shadows on the face/body.
- Resolution: 1024×1024 or higher recommended. Low-res photos produce poor results.
- Angle: front-facing photos work best for most categories.
- Background: any background works, but clean backgrounds produce cleaner results.
- Pose: natural, relaxed poses. Avoid extreme angles or heavy cropping.
- 光线: 光线充足、均匀的照片效果最佳。避免面部/身体出现强烈阴影。
- 分辨率: 推荐1024×1024或更高分辨率。低分辨率照片会导致效果不佳。
- 角度: 正面照片适合大多数类别。
- 背景: 任何背景均可,但干净背景会产生更清晰的结果。
- 姿势: 自然放松的姿势。避免极端角度或过度裁剪。
Garment/item photo guidelines
服饰/物品照片指南
- Product shots work best: official product images on white/neutral backgrounds.
- Clear visibility: the item should be the main focus, not obscured.
- Multiple angles: front view is most important for clothing.
- Color accuracy: ensure the photo shows true colors (no heavy filters).
- High resolution: detailed product images produce better try-on results.
- 产品图效果最佳: 白色/中性背景的官方产品图。
- 清晰可见: 物品需为画面主体,无遮挡。
- 多角度: 服装类优先提供正面视图。
- 颜色准确: 照片需呈现物品真实颜色(无过重滤镜)。
- 高分辨率: 细节丰富的产品图会带来更好的试穿效果。
9. Prompt engineering for custom try-on
9. 自定义试穿的提示词工程
When the default category prompt doesn't produce the desired result, use a custom . Follow these guidelines:
prompt当默认类别提示词无法产生理想结果时,可使用自定义。请遵循以下指南:
promptThe 5-element try-on prompt structure
试穿提示词五要素结构
[person preservation] + [item description] + [fit/positioning] + [style/mood] + [quality anchors][人物身份保留] + [物品描述] + [贴合度/位置] + [风格/氛围] + [质量锚点]Key principles
核心原则
- Always preserve identity: "Keep the person's face, body shape, and pose exactly the same."
- Describe the item clearly: "wearing the red leather jacket from the second image"
- Specify fit and positioning: "natural draping, proper shoulder fit, realistic wrinkles"
- Add style context: "casual street style look", "formal business attire"
- Quality anchors: "professional fashion photography", "editorial quality", "realistic shadows"
- 始终保留身份: “保持人物的面部、体型和姿势完全不变。”
- 清晰描述物品: “穿着第二张图片中的红色皮夹克”
- 指定贴合度和位置: “自然垂坠,肩部贴合合身,褶皱真实”
- 添加风格背景: “休闲街头风格”、“正式商务着装”
- 质量锚点: “专业时尚摄影”、“杂志级画质”、“真实阴影”
Example custom prompts
自定义提示词示例
Formal outfit:
The person is wearing the navy blue suit from the second image. Keep the person's face, body, and pose exactly the same. The suit should fit perfectly with proper tailoring — clean shoulder line, correct sleeve length, natural lapel lay. Professional fashion photography quality with studio lighting.Casual street style:
The person is wearing the oversized hoodie from the second image in a relaxed street style. Keep the person's identity and pose the same. The hoodie should drape naturally with realistic fabric weight and casual fit. Urban photography style.Jewelry combination:
The person is wearing the diamond pendant necklace from the second image. Keep everything about the person the same. The necklace should sit naturally on the collarbone with realistic sparkle and light reflections. The chain length and pendant size should be proportional to the person's frame.正式穿搭:
人物穿着第二张图片中的深蓝色西装。保持人物的面部、体型和姿势完全不变。西装需完美合身,剪裁得体——肩部线条利落,袖长合适,翻领自然贴合。达到专业时尚摄影的棚拍灯光画质。休闲街头风格:
人物穿着第二张图片中的超大号连帽衫,呈现放松的街头风格。保持人物身份和姿势不变。连帽衫需自然垂坠,体现真实面料重量和休闲版型。采用都市摄影风格。珠宝搭配:
人物佩戴第二张图片中的钻石吊坠项链。人物的所有特征保持不变。项链需自然贴合锁骨,呈现真实的光泽和光线反射效果。链条长度和吊坠大小需与人物体型比例协调。10. Error handling
10. 错误处理
| Error | Cause | Solution |
|---|---|---|
| "Person image error: Either person_path or person_url must be provided" | Missing person photo | Ask user for their photo |
| "Garment/item image error: Either garment_path or garment_url must be provided" | Missing item photo | Ask user for the item photo |
| "File not found" | Invalid file path | Check the file path and try again |
| "Unsupported image format" | Non-image file | Use JPG, PNG, or WebP |
| "Image too large" | File > 10 MB | Resize or compress the image |
| "Unknown category" | Invalid category key | Use one of the 8 valid categories |
| Low quality result | Poor input photos | Use higher resolution, well-lit photos |
| Wrong item placement | Unclear body positioning | Use front-facing photos with target area visible |
| 错误信息 | 原因 | 解决方案 |
|---|---|---|
| "Person image error: Either person_path or person_url must be provided" | 缺少人物照片 | 请求用户提供其照片 |
| "Garment/item image error: Either garment_path or garment_url must be provided" | 缺少物品照片 | 请求用户提供物品照片 |
| "File not found" | 文件路径无效 | 检查文件路径后重试 |
| "Unsupported image format" | 非图片文件 | 使用JPG、PNG或WebP格式 |
| "Image too large" | 文件大小超过10MB | 调整图片尺寸或压缩文件 |
| "Unknown category" | 类别标识无效 | 使用8个有效类别之一 |
| 结果质量差 | 输入照片质量不佳 | 使用更高分辨率、光线良好的照片 |
| 物品位置错误 | 身体姿势不清晰 | 使用正面照片并确保目标区域可见 |
11. When NOT to use this skill
11. 不适用场景
- Single image editing (no garment/item reference) → use skill
image-edit - Portrait generation (styled photos from one reference) → use skill
image-portrait - Text-to-image (no reference photos at all) → use skill
image-create - Fashion model generation (creating models from scratch) → use skill
image-create
- 单张图片编辑(无服饰/物品参考)→ 使用技能
image-edit - 肖像生成(基于单张参考图生成风格化照片)→ 使用技能
image-portrait - 文本生成图片(无参考照片)→ 使用技能
image-create - 时尚模特生成(从零创建模特)→ 使用技能
image-create