「Flux.2 Klein 9B:圖像擴展」工作流程專為利用 FLUX.2 Klein 9B 模型擴展與增強圖像而設計。此流程擅長外延(outpainting),即在維持原始風格與內容下,延伸圖像邊界。流程結合 SamplerCustomAdvanced、CLIPLoader、RandomNoise 等進階節點,產生無縫延伸的圖像。透過 ComfyUI-Color-Matcher 與 comfyui-kjnodes,確保色彩一致與風格連貫,特別適合藝術家與設計師將有限素材擴展為大幅構圖。
技術上,流程先用 LoadImage 載入圖像,經 VAEEncode 節點編碼至潛在空間,再用 ImagePadForOutpaint 節點擴展畫布。Flux2Scheduler 與 UNETLoader 節點協同產生新圖像內容,自然融合原有內容。CFGGuider 與 KSamplerSelect 節點根據提示詞與條件細緻調控生成。外延完成後,VAEDecode 節點將潛在表示轉回可見圖像,供儲存或後續編輯。
API
從程式碼使用此工作流
每個 Comfy 工作流都是一個 JSON 圖。下方的 payload 就是此工作流,與 ComfyUI 執行時完全相同 — 你可以從此 URL 取得、放入版本控制,或在 ComfyUI 載入並逐節點執行。
使用 Comfy SDK 以 TypeScript 或 Python 執行。相同程式碼可用於 Comfy Cloud 或你自架的 ComfyUI — 只需更改 base URL。
// Install (beta)
npm i @comfyorg/sdk
// Run "Flux.2 Klein 9B:圖像擴充" (TypeScript)
import { Comfy } from "@comfyorg/sdk";
const client = new Comfy({ apiKey: "comfyui-..." });
// This workflow, exported in API format (see note below)
const wf = await client.workflows.fromFile("templates_doc_workbox_klein_9b_image_extend_api.json");
const asset = client.assets.fromFile("input.png");
wf.setInput("159", "image", asset); // LoadImage
wf.setInput("157", "text", "remove the green part"); // CLIPTextEncode
const job = await client.run(wf);
await job.getOutputs("142")[0].toFile("output.png"); // SaveImageSDK 需使用 API 格式的工作流:請在 ComfyUI 開啟此工作流,並使用 檔案 → 匯出工作流(API)。
常見問題
常見問題
Showing 30 of 30 templates















