交換手中商品,UGC風格
上傳一張角色拿著產品和你品牌產品的照片,產生產品已互換的圖片。
工作流程內部
來源範本的唯讀預覽。請在 Cloud 中開啟,以探索節點並進行變更。
Loading the graph
Open full-size workflow preview執行於
- 輸出
- 圖片
- 作者
- Rob
從您的程式碼呼叫此模型
以下請求使用與 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({
"10": {
"class_type": "LoadImage",
"inputs": {
"image": "UPLOADED_subject_FILENAME"
},
"_meta": {
"title": "Load Subject Image"
}
},
"11": {
"class_type": "LoadImage",
"inputs": {
"image": "UPLOADED_product_FILENAME"
},
"_meta": {
"title": "Load Product Image"
}
},
"15": {
"class_type": "SaveImage",
"inputs": {
"filename_prefix": "ComfyUI",
"images": [
"17",
0
]
},
"_meta": {
"title": "Save Image"
}
},
"17": {
"class_type": "GeminiImage2Node",
"inputs": {
"aspect_ratio": "auto",
"images": [
"18:19",
0
],
"model": "gemini-3-pro-image-preview",
"prompt": "Swap the product the woman is holding in image 1 with the product in image 2. Replace the small amber dropper bottle in her hand with the black faceted stone jar with the chrome lid from image 2, held up beside her cheek the same way, at a believable size for a small skincare jar, with her fingers wrapped naturally around it. Keep her face, smile, hair, grey knit sweater, the kitchen, the rainy loft windows and the warm pendant light exactly as they are, and match the jar's reflections and shadows to the lighting of the room so it looks like a casual product review photo.",
"resolution": "2K",
"response_modalities": "IMAGE+TEXT",
"seed": 467727850770885,
"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."
},
"_meta": {
"title": "Nano Banana Pro (Google Gemini Image)"
}
},
"18:12": {
"class_type": "GetImageSize",
"inputs": {
"image": [
"10",
0
]
},
"_meta": {
"title": "Get Image Size"
}
},
"18:13": {
"class_type": "ResizeAndPadImage",
"inputs": {
"image": [
"11",
0
],
"interpolation": "area",
"padding_color": "white",
"target_height": [
"18:12",
1
],
"target_width": [
"18:12",
0
]
},
"_meta": {
"title": "Resize And Pad Image"
}
},
"18:19": {
"class_type": "BatchImagesNode",
"inputs": {
"images.image0": [
"10",
0
],
"images.image1": [
"18:13",
0
]
},
"_meta": {
"title": "Batch Images"
}
}
})
workflow.set_input("11", "image", client.assets.from_url("https://comfy.org/catalog-media/7c26aba1-401b-47fb-9d60-0aef1db0c7f5/b3eb27b2-9c68-4759-ae27-90ce58074375"))
workflow.set_input("10", "image", client.assets.from_url("https://comfy.org/catalog-media/e300b50e-505a-4334-b952-a8c2bd2b7abe/292f71b8-d912-4cc3-b207-9493584eb367"))
# 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("15"):
output.to_file(output.name)試試範例
關於此工作流程
此 ComfyUI 工作流程可將角色手中產品無縫替換為其他產品,特別適合行銷用戶生成內容(UGC)。流程結合 Gemini3 Pro Image Preview 與 Nano Banana Pro 等先進 AI 模型,確保圖像操作自然且維持原始照片質感。流程從 'LoadImage' 節點開始,使用者上傳角色持有產品的照片。'GeminiImage2Node' 處理圖像,辨識並分離產品以便替換。自訂節點 'e20a7fb5-3d72-41c9-a78c-fdf287ec46ec' 會將使用者提供的新產品圖像無縫整合至原圖。最後,'SaveImage' 節點輸出修改後圖像,可直接用於行銷或社群。
技術上,本流程運用 AI 自動偵測並替換圖像中的物件,省去傳統手動修圖。自動化不僅節省時間,也確保多張圖像品質一致。結合 Google 與 Nano Banana Pro 等模型,提升物件偵測與替換準確度,特別適合品牌快速調整行銷視覺、因應不同產品或活動。
問答
產品清楚可見且光線良好的圖片最適合,能讓 AI 更準確偵測並替換產品。
此工作流程針對清晰、簡單背景做了最佳化;也能處理一定程度的複雜度,但結果會依圖片品質與背景細節而異。
目前此工作流程設計為每張圖片只處理一次產品替換。若要替換多個產品,需分別處理每個產品。
輸入與輸出都支援常見的圖片格式,例如 JPEG 與 PNG,能與多數數位平台相容。