Flux.1 Kontext 多圖像輸入
輸入多個圖像並使用Flux.1 Kontext進行編輯。
下載工作流程在 Cloud 中試用 API 文件
工作流程內部
來源範本的唯讀預覽。請在 Cloud 中開啟,以探索節點並進行變更。
Loading the graph
Open full-size workflow preview- 輸出
- 圖片
- 作者
- ComfyUI
從您的程式碼呼叫此模型
以下請求使用與 Playground 相同的已準備節點圖和設定。每次提交都可能啟動付費執行;若提交結果不明,請勿自動重試提交。
1 取得 API 金鑰 ↗
What you need
- Runs on
- Comfy Cloud
- 金鑰
- COMFY_API_KEY
- 您的檔案
- 由程式碼透過其 URL 上傳
需要付費 Cloud 方案與點數。
下載 API JSONAPI 文件 ↗
# 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({
"83": {
"class_type": "FluxKontextProImageNode",
"inputs": {
"aspect_ratio": "16:9",
"guidance": 3,
"input_image": [
"98",
0
],
"prompt": "The man with the mustache from the first image sits relaxed on the cognac leather sofa from the third image, leaning back with one arm along the backrest and his legs crossed, still wearing his mustard corduroy jacket and burnt-orange turtleneck. The long-haired silver Maine Coon cat from the second image is curled up asleep on the cushion beside him, its fluffy tail draped over his knee. Keep the twilight living room exactly as it is: the arc floor lamp casting a warm amber pool of light, the tall steel-framed windows with rain on the glass, the concrete walls and the charcoal rug. Cinematic interior photograph, natural proportions, soft warm and cool contrast.",
"prompt_upsampling": False,
"seed": 323708991831609,
"steps": 50
},
"_meta": {
"title": "Flux.1 Kontext [pro] Image"
}
},
"84": {
"class_type": "LoadImage",
"inputs": {
"image": "UPLOADED_image_1_FILENAME"
},
"_meta": {
"title": "Load Image"
}
},
"85": {
"class_type": "SaveImage",
"inputs": {
"filename_prefix": "ComfyUI",
"images": [
"83",
0
]
},
"_meta": {
"title": "Save Image"
}
},
"90": {
"class_type": "PreviewImage",
"inputs": {
"images": [
"98",
0
]
},
"_meta": {
"title": "Preview Image"
}
},
"91": {
"class_type": "LoadImage",
"inputs": {
"image": "UPLOADED_image_3_FILENAME"
},
"_meta": {
"title": "Load Image"
}
},
"96": {
"class_type": "LoadImage",
"inputs": {
"image": "UPLOADED_image_2_FILENAME"
},
"_meta": {
"title": "Load Image"
}
},
"97": {
"class_type": "ImageStitch",
"inputs": {
"direction": "up",
"image1": [
"84",
0
],
"image2": [
"96",
0
],
"match_image_size": True,
"spacing_color": "white",
"spacing_width": 8
},
"_meta": {
"title": "Stitch Images"
}
},
"98": {
"class_type": "ImageStitch",
"inputs": {
"direction": "right",
"image1": [
"97",
0
],
"image2": [
"91",
0
],
"match_image_size": True,
"spacing_color": "white",
"spacing_width": 20
},
"_meta": {
"title": "Stitch Images"
}
}
})
workflow.set_input("84", "image", client.assets.from_url("https://comfy.org/catalog-media/18bce541-baf6-4132-82aa-3cfa614f81d2/1e81b9f7-e2b3-44d8-903e-1a153aee1e9a"))
workflow.set_input("96", "image", client.assets.from_url("https://comfy.org/catalog-media/129dc51d-f36c-4561-9e53-535bb3f6552b/e708da58-5617-40ea-a109-a849389dfc80"))
workflow.set_input("91", "image", client.assets.from_url("https://comfy.org/catalog-media/76a44330-564a-4b90-8a92-20748a616b1e/5d5cfa81-0ba4-4f4a-ba0a-4e8894b2464d"))
# 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("85"):
output.to_file(output.name)試試範例
關於此工作流程
「Flux.1 Kontext 多圖輸入」工作流程,專為利用 Flux.1 Kontext 模型,同步批次編輯多張圖像而設計。流程運用 FluxKontextProImageNode 處理、LoadImage 匯入、SaveImage 匯出成果。ImageStitch 節點可將多圖合併為一,PreviewImage 節點可即時預覽編輯效果。適合需批次處理風格轉換或色彩調整的用戶。
技術上,流程先用 LoadImage 載入多張圖像,經 FluxKontextProImageNode 處理,可進行色彩變更、風格轉換等編輯。PreviewImage 節點可即時檢查效果,最後用 SaveImage 匯出。此流程特別適合需維持一系列圖像風格一致的創作者,或需高效批次編輯的應用。
問答
可以,但建議使用尺寸相近的圖像以獲得最佳效果。
統一設定 FluxKontextProImageNode 參數,即可確保所有圖像套用相同編輯。
可以,PreviewImage 節點可即時預覽,調整滿意後再儲存。
可用 ImageStitch 節點將多圖合併為單一輸出。