角色肖像服裝套用
上傳角色肖像與服裝參考圖,生成套用指定服裝的新肖像,實現服裝一致性。是 Nano Banana Pro 與 Nano Banana 2 的平價替代方案。
工作流程內部
來源範本的唯讀預覽。請在 Cloud 中開啟,以探索節點並進行變更。
Loading the graph
Open full-size workflow preview從您的程式碼呼叫此模型
以下請求使用與 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({
"11": {
"class_type": "SaveImage",
"inputs": {
"filename_prefix": "ComfyUI-image_main_reference",
"images": [
"228",
0
]
},
"_meta": {
"title": "Save Image"
}
},
"16": {
"class_type": "LoadImage",
"inputs": {
"image": "UPLOADED_subject_full_FILENAME"
},
"_meta": {
"title": "Load Subject Image"
}
},
"18": {
"class_type": "RegexReplace",
"inputs": {
"case_insensitive": True,
"count": 0,
"dotall": False,
"multiline": False,
"regex_pattern": "{outfit}",
"replace": "",
"string": [
"23",
0
]
},
"_meta": {
"title": "Replace Text (Regex)"
}
},
"23": {
"class_type": "PrimitiveStringMultiline",
"inputs": {
"value": "Generate a high-fashion studio image of the subject from Image 1 and Image 2, wearing the exact outfit from Image 3.\n\nImage 1 and Image 2 define the subject’s identity and body proportions.\nImage 3 defines only the outfit and must match exactly.\n\nFull-body shot.\nSubject facing forward, standing naturally.\nNeutral expression.\n\nClean white studio background.\nHard flash lighting.\n55mm lens look.\nFuji Velvia film aesthetic.\n\nSlightly overexposed.\nStrong visible film grain.\nHighly saturated colors.\n\nDo not change the subject’s identity, clothing, or accessories."
},
"_meta": {
"title": "Prompt Template"
}
},
"26": {
"class_type": "LoadImage",
"inputs": {
"image": "UPLOADED_outfit_FILENAME"
},
"_meta": {
"title": "Full Body Outift"
}
},
"226": {
"class_type": "LoadImage",
"inputs": {
"image": "UPLOADED_subject_close_FILENAME"
},
"_meta": {
"title": "Load Subject Image"
}
},
"228": {
"class_type": "ByteDanceSeedreamNode",
"inputs": {
"fail_on_partial": True,
"height": 2048,
"image": [
"28:225",
0
],
"max_images": 1,
"model": "seedream 5.0 lite",
"prompt": [
"18",
0
],
"seed": 2000540261,
"sequential_image_generation": "disabled",
"size_preset": "2560x1440 (16:9)",
"watermark": False,
"width": 2048
},
"_meta": {
"title": "ByteDance Seedream 4.5 & 5.0"
}
},
"257": {
"class_type": "ByteDanceSeedreamNode",
"inputs": {
"fail_on_partial": True,
"height": 2048,
"image": [
"28:225",
0
],
"max_images": 1,
"model": "seedream 5.0 lite",
"prompt": [
"260",
0
],
"seed": 1405040888,
"sequential_image_generation": "disabled",
"size_preset": "2560x1440 (16:9)",
"watermark": False,
"width": 2048
},
"_meta": {
"title": "ByteDance Seedream 4.5 & 5.0"
}
},
"258": {
"class_type": "SaveImage",
"inputs": {
"filename_prefix": "ComfyUI-image_main_reference",
"images": [
"257",
0
]
},
"_meta": {
"title": "Save Image"
}
},
"259": {
"class_type": "PrimitiveStringMultiline",
"inputs": {
"value": "High-fashion studio close-up of the subject from Image 1 and Image 2, wearing the exact outfit from Image 3 (visible portion only).\n\nIdentity and facial structure must match Image 1 and 2 exactly.\n\nTight close-up (mid-chest to top of head).\nLow-angle, subject centered.\nLooking slightly past camera, bored expression, subtly raised eyebrows.\n\n\nWhite studio background.\nHard flash.\n55mm lens look.\nFuji Velvia aesthetic.\n\nSlight overexposure, strong film grain, highly saturated colors.\n\nNo changes to identity, clothing, or accessories."
},
"_meta": {
"title": "Prompt Template"
}
},
"260": {
"class_type": "RegexReplace",
"inputs": {
"case_insensitive": True,
"count": 0,
"dotall": False,
"multiline": False,
"regex_pattern": "{outfit}",
"replace": "",
"string": [
"259",
0
]
},
"_meta": {
"title": "Replace Text (Regex)"
}
},
"274": {
"class_type": "GeminiNanoBanana2",
"inputs": {
"aspect_ratio": "auto",
"model": "Nano Banana 2 (Gemini 3.1 Flash Image)",
"prompt": "",
"resolution": "1K",
"response_modalities": "IMAGE",
"seed": 858333317454308,
"system_prompt": "You are an expert image-generation engine. You must ALWAYS produce an image.\nInterpret all user input—regardless of format, intent, or abstraction—as literal visual directives for image composition.\nIf a prompt is conversational or lacks specific visual details, you must creatively invent a concrete visual scenario that depicts the concept.\nPrioritize generating the visual representation above any text, formatting, or conversational requests.",
"thinking_level": "MINIMAL"
},
"_meta": {
"title": "Nano Banana 2"
}
},
"28:15": {
"class_type": "ResizeAndPadImage",
"inputs": {
"image": [
"226",
0
],
"interpolation": "area",
"padding_color": "white",
"target_height": [
"28:177",
1
],
"target_width": [
"28:177",
0
]
},
"_meta": {
"title": "Resize And Pad Image"
}
},
"28:177": {
"class_type": "GetImageSize",
"inputs": {
"image": [
"16",
0
]
},
"_meta": {
"title": "Get Image Size"
}
},
"28:224": {
"class_type": "ResizeAndPadImage",
"inputs": {
"image": [
"26",
0
],
"interpolation": "area",
"padding_color": "white",
"target_height": [
"28:177",
1
],
"target_width": [
"28:177",
0
]
},
"_meta": {
"title": "Resize And Pad Image"
}
},
"28:225": {
"class_type": "ImageBatch",
"inputs": {
"image1": [
"28:5",
0
],
"image2": [
"28:224",
0
]
},
"_meta": {
"title": "Batch Images (DEPRECATED)"
}
},
"28:5": {
"class_type": "ImageBatch",
"inputs": {
"image1": [
"16",
0
],
"image2": [
"28:15",
0
]
},
"_meta": {
"title": "Batch Images (DEPRECATED)"
}
}
})
workflow.set_input("26", "image", client.assets.from_url("https://comfy.org/catalog-media/d0625f61-d16c-4168-ab04-c76ac40a3e6e/466e0ed8-f584-4697-bf8a-10f30c547101"))
workflow.set_input("226", "image", client.assets.from_url("https://comfy.org/catalog-media/982f5e41-1b57-4e48-91da-144f0c7b7646/83a50b7d-3a15-42ea-a3e2-2c709a753672"))
workflow.set_input("16", "image", client.assets.from_url("https://comfy.org/catalog-media/357bf933-c68b-497c-8fe6-a052a9911158/53dc3695-c105-4eb3-ad0b-8af8f9dae3e2"))
# 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("11"):
output.to_file(output.name)
for output in job.get_outputs("258"):
output.to_file(output.name)試試範例
關於此工作流程
此 ComfyUI 工作流程用於將特定服裝套用到角色人像上,讓不同圖片維持一致的穿搭。透過 Seedream 4.5 模型,你可以上傳角色肖像以及一張服裝參考圖,工作流程會產生一張新的肖像:保留角色原本特徵,同時替換成指定服裝。LoadImage 與 SaveImage 節點用於匯入與匯出圖片,ByteDanceSeedreamNode 與 GeminiNanoBanana2 節點負責影像處理與轉換。RegexReplace 與 PrimitiveStringMultiline 節點則協助文字處理,確保檔名與路徑在整個流程中正確管理。
在技術上,此工作流程整合主體參考圖片,並提供全身以及特寫輸出,讓你能在不同穿搭情境中檢視角色。這對希望保持角色設計一致性、又不想為每套服裝手動重畫的創作者與設計師特別有用。此工作流程也可作為比 Nano Banana Pro 與 Nano Banana 2 等工具更省成本的替代方案,以較低成本提供相近功能,適合需要效率與成本控管的創作產業使用。
問答
高解析度、五官清楚的角色肖像,以及光線良好、清晰的服裝參考圖,效果最好。
可以,只要角色特徵足夠清楚,且參考服裝與角色體型相容即可。
你可以調整 ByteDanceSeedreamNode 的設定,讓服裝更貼合角色的身形與姿勢。
此流程以 Seedream 4.5 設計為主,你也可以嘗試其他模型,但結果可能會因模型相容性而不同。
相關工作流程
- Nano Banana Pro, Gemini3 Pro Image Preview, Google
Create a character turnaround
- Qwen-Image-Edit
Change a material
- Qwen-Image-Edit
See your subject from a new angle
- Flux.2 Dev, Flux
Create a product mockup
- Nano Banana Pro
Try an outfit on a character
- Seedream
Put your product in a new scene
- SSeedVR2
Upscale and restore detail
- Nano Banana Pro
Sharpen a product photo
- Topaz
Upscale an illustration
- HHitPaw
Restore portrait detail
- FLUX.1 Fill
Edit a selected region
- FLUX.1 Fill
Extend an image’s borders