Clothes Changer
這個應用讓你能在任何照片中更換服裝!一鍵切換風格、探索新造型,甚至可為你的商店創造行銷級照片,完全零難度。只需上傳角色與參考服裝,就是這麼簡單。
工作流程內部
來源範本的唯讀預覽。請在 Cloud 中開啟,以探索節點並進行變更。
從您的程式碼呼叫此模型
以下請求使用與 Playground 相同的已準備節點圖和設定。每次提交都可能啟動付費執行;若提交結果不明,請勿自動重試提交。
What you need
- Runs on
- Comfy Cloud
- 金鑰
- COMFY_API_KEY
- 您的檔案
- 由程式碼透過其 URL 上傳
需要付費 Cloud 方案與點數。
# Python 3.10+: pip install comfy-sdk==0.4.0
import os
from comfy_sdk import Comfy
api_key = os.environ.get("COMFY_API_KEY", "").strip()
if not api_key: raise RuntimeError("Set COMFY_API_KEY")
os.environ.setdefault("COMFY_BASE_URL", "https://cloud.comfy.org")
client = Comfy(api_key=api_key)
workflow = client.workflows.from_json({
"266": {
"class_type": "LoadImage",
"inputs": {
"image": "UPLOADED_person_FILENAME"
},
"_meta": {
"title": "Load Image"
}
},
"267": {
"class_type": "LoadImage",
"inputs": {
"image": "UPLOADED_outfit_FILENAME"
},
"_meta": {
"title": "Load Image"
}
},
"294": {
"class_type": "SaveImage",
"inputs": {
"filename_prefix": "Qwen_Edit_2511",
"images": [
"293:289",
0
]
},
"_meta": {
"title": "Save Image"
}
},
"293:269": {
"class_type": "ModelSamplingAuraFlow",
"inputs": {
"model": [
"293:322",
0
],
"sampling": "flow",
"shift": 3.1
},
"_meta": {
"title": "ModelSamplingAuraFlow"
}
},
"293:270": {
"class_type": "VAELoader",
"inputs": {
"vae_name": "qwen_image_vae.safetensors"
},
"_meta": {
"title": "Load VAE"
}
},
"293:274": {
"class_type": "TextEncodeQwenImageEditPlus",
"inputs": {
"clip": [
"293:281",
0
],
"image1": [
"293:290",
0
],
"image2": [
"293:292",
0
],
"prompt": [
"293:337",
0
],
"vae": [
"293:270",
0
]
},
"_meta": {
"title": "TextEncodeQwenImageEditPlus (Positive)"
}
},
"293:275": {
"class_type": "CFGNorm",
"inputs": {
"model": [
"293:269",
0
],
"pre_cfg": False,
"strength": 1
},
"_meta": {
"title": "CFGNorm"
}
},
"293:276": {
"class_type": "LoraLoaderModelOnly",
"inputs": {
"lora_name": "Qwen-Image-Edit-2511-Lightning-4steps-V1.0-bf16.safetensors",
"model": [
"293:275",
0
],
"strength_model": 1
},
"_meta": {
"title": "Load LoRA"
}
},
"293:277": {
"class_type": "PrimitiveFloat",
"inputs": {
"value": 4
},
"_meta": {
"title": "CFG"
}
},
"293:278": {
"class_type": "PrimitiveFloat",
"inputs": {
"value": 1
},
"_meta": {
"title": "CFG"
}
},
"293:279": {
"class_type": "VAEEncode",
"inputs": {
"pixels": [
"293:290",
0
],
"vae": [
"293:270",
0
]
},
"_meta": {
"title": "VAE Encode"
}
},
"293:280": {
"class_type": "UNETLoader",
"inputs": {
"unet_name": "qwen_image_edit_2511_bf16.safetensors",
"weight_dtype": "default"
},
"_meta": {
"title": "Load Diffusion Model"
}
},
"293:281": {
"class_type": "CLIPLoader",
"inputs": {
"clip_name": "qwen_2.5_vl_7b_fp8_scaled.safetensors",
"device": "default",
"type": "qwen_image"
},
"_meta": {
"title": "Load CLIP"
}
},
"293:282": {
"class_type": "ComfySwitchNode",
"inputs": {
"on_false": [
"293:275",
0
],
"on_true": [
"293:276",
0
],
"switch": [
"293:285",
0
]
},
"_meta": {
"title": "Switch (Model)"
}
},
"293:283": {
"class_type": "PrimitiveInt",
"inputs": {
"value": 6
},
"_meta": {
"title": "Steps"
}
},
"293:284": {
"class_type": "PrimitiveInt",
"inputs": {
"value": 30
},
"_meta": {
"title": "Steps"
}
},
"293:285": {
"class_type": "PrimitiveBoolean",
"inputs": {
"value": True
},
"_meta": {
"title": "Enable 4steps LoRA?"
}
},
"293:286": {
"class_type": "ComfySwitchNode",
"inputs": {
"on_false": [
"293:277",
0
],
"on_true": [
"293:278",
0
],
"switch": [
"293:285",
0
]
},
"_meta": {
"title": "Switch (CFG)"
}
},
"293:287": {
"class_type": "ComfySwitchNode",
"inputs": {
"on_false": [
"293:284",
0
],
"on_true": [
"293:283",
0
],
"switch": [
"293:285",
0
]
},
"_meta": {
"title": "Switch (Steps)"
}
},
"293:288": {
"class_type": "KSampler",
"inputs": {
"cfg": [
"293:286",
0
],
"denoise": 1,
"latent_image": [
"293:279",
0
],
"model": [
"293:282",
0
],
"negative": [
"293:291",
0
],
"positive": [
"293:274",
0
],
"sampler_name": "euler",
"scheduler": "simple",
"seed": 525225493084341,
"steps": [
"293:287",
0
]
},
"_meta": {
"title": "KSampler"
}
},
"293:289": {
"class_type": "VAEDecode",
"inputs": {
"samples": [
"293:288",
0
],
"vae": [
"293:270",
0
]
},
"_meta": {
"title": "VAE Decode"
}
},
"293:290": {
"class_type": "FluxKontextImageScale",
"inputs": {
"image": [
"266",
0
]
},
"_meta": {
"title": "FluxKontextImageScale"
}
},
"293:291": {
"class_type": "TextEncodeQwenImageEditPlus",
"inputs": {
"clip": [
"293:281",
0
],
"image1": [
"293:290",
0
],
"image2": [
"293:292",
0
],
"prompt": "",
"vae": [
"293:270",
0
]
},
"_meta": {
"title": "Text Encode Qwen Image Edit Plus"
}
},
"293:292": {
"class_type": "FluxKontextImageScale",
"inputs": {
"image": [
"267",
0
]
},
"_meta": {
"title": "FluxKontextImageScale"
}
},
"293:322": {
"class_type": "LoraLoaderModelOnly",
"inputs": {
"lora_name": "Qwen-Image-Edit-2509-clothes_try_on_clothing_transfer_edit.safetensors",
"model": [
"293:280",
0
],
"strength_model": 1
},
"_meta": {
"title": "Load LoRA"
}
},
"293:330": {
"class_type": "TextGenerateLTX2Prompt",
"inputs": {
"clip": [
"293:332",
0
],
"image": [
"267",
0
],
"max_length": 256,
"mtp": "auto",
"prompt": "You are a garment tagger for a virtual try-on pipeline. The user message contains one image of an outfit (flat lay or product grid).\n\nOutput a single lowercase phrase enumerating every wearable item in the image, and nothing else — no preamble, no labels, no quotes, no trailing period, no line breaks.\n\nRules:\n- Describe each item as: [color/wash] [material or texture, if visually distinctive] [fit/cut, if notable] [garment type], e.g. \"washed brown oversized hoodie\", \"tan suede crossbody bag\".\n- Order: main top, bottoms, then accessories (headwear, belt, bag), footwear last.\n- Separate items with commas, with \"and\" before the last item.\n- For bags, append how they are worn if inferable, e.g. \"worn across the chest\".\n- Include only items visible in the image; never invent items, brands, or logos.\n- Mention a brand or printed text only if clearly legible on the garment.\n- If the image contains no clothing, output exactly: no garments detected",
"sampling_mode": "on",
"sampling_mode.min_p": 0.05,
"sampling_mode.presence_penalty": 0,
"sampling_mode.repetition_penalty": 1.05,
"sampling_mode.seed": 123456789,
"sampling_mode.temperature": 0.7,
"sampling_mode.top_k": 64,
"sampling_mode.top_p": 0.95,
"thinking": False,
"use_default_template": True
},
"_meta": {
"title": "Generate Prompt"
}
},
"293:331": {
"class_type": "PreviewAny",
"inputs": {
"source": [
"293:330",
0
]
},
"_meta": {
"title": "Preview as Text"
}
},
"293:332": {
"class_type": "CLIPLoader",
"inputs": {
"clip_name": "qwen3.5_4b_bf16.safetensors",
"device": "default",
"type": "stable_diffusion"
},
"_meta": {
"title": "CLIP Loader"
}
},
"293:335": {
"class_type": "StringConcatenate",
"inputs": {
"delimiter": " ",
"string_a": "Put the clothes on the left onto the person on the right.\nDress the subject from the first image in the outfit from the second image:",
"string_b": [
"293:331",
0
]
},
"_meta": {
"title": "Concatenate Text"
}
},
"293:336": {
"class_type": "StringConcatenate",
"inputs": {
"delimiter": " ",
"string_a": [
"293:335",
0
],
"string_b": "Keep his face, hair, body proportions, pose, and the background exactly the same. The garments must match the clothing exactly in color, fabric texture, and details. Photorealistic fashion photo."
},
"_meta": {
"title": "Concatenate Text"
}
},
"293:337": {
"class_type": "PreviewAny",
"inputs": {
"source": [
"293:336",
0
]
},
"_meta": {
"title": "Preview as Text"
}
}
})
workflow.set_input("267", "image", client.assets.from_url("https://comfy.org/catalog-media/6f8721d3-d594-43c6-9c0f-5dcfa3a9f2a7/bfbc898f-6812-45d2-95fb-5c9696404fb7"))
workflow.set_input("266", "image", client.assets.from_url("https://comfy.org/catalog-media/02c308b6-ea0c-4040-b14a-0819feb9a6a3/5507a16d-9ddd-48cb-8ea9-25e7c3f5082b"))
# run() also passes api_key to the partner nodes in this workflow.
job = client.run(workflow, api_key=api_key)
for output in job.get_outputs("294"):
output.to_file(output.name)試試範例
關於此工作流程
Clothes Changer 是一個虛擬試穿工作流程,會把人物照片中的服裝替換成參考服裝圖片。它將兩個 LoadImage 節點(一個用於人物/角色,一個用於服裝)連接到自訂 Clothes Changer 節點(a41effc1-fe4c-4b79-a70d-9b7388ef6a23),再用 SaveImage 節點儲存結果。工作流程精簡直接:LoadImage → Clothes Changer (a41effc1-...) → SaveImage,讓你一次執行就能從輸入到輸出成品。
在技術面上,Clothes Changer 節點會接收人物/角色影像與服裝參考,將衣物對齊到主體姿勢,並在保留臉部特徵、髮型與身體結構的前提下完成合成。這類節點內通常包含:偵測衣物區域、依姿勢進行對齊/形變,以及乾淨的混合以避免邊緣產生瑕疵。由於全部都在 ComfyUI 內執行,你可以快速迭代:更換輸入、調整節點設定(若你的版本有提供),並重新加入佇列以微調合身度、覆蓋範圍與輸出尺寸。
問答
使用清晰、光線充足的圖片,最短邊建議在 768–1536 px。角色圖與服裝圖的尺寸盡量接近,有助於對齊並降低瑕疵。
Clothes Changer 節點設計目標是保留身分特徵(臉部、髮型與身體結構),只替換衣物。邊緣可能出現些微混合;更好的構圖與更高解析度輸入通常能改善。
可以,但當衣物與背景分離度更高時結果通常更乾淨。平鋪(flat-lay)或清楚對比的上身實拍通常效果最好。正面服裝一般更容易可靠對齊。
SaveImage 節點會將檔案寫入 ComfyUI/output 資料夾。你可以在 SaveImage 節點中設定檔案名稱前綴,方便版本管理。