本 ComfyUI 工作流程採用 Stability AI 的 SD 3.5 Large 模型與 Canny ControlNet,根據輸入圖像的邊緣結構生成新圖像。流程會載入 SD 3.5 checkpoint(CheckpointLoaderSimple)與 Canny ControlNet(ControlNetLoader),將你的文字提示編碼(CLIPTextEncode),並從導引圖像提取高對比邊緣圖(Canny)。邊緣圖作為結構約束,透過 ControlNetApplyAdvanced 讓 KSampler 生成內容時能遵循輪廓,同時依照你的提示詞進行創作。
技術上,流程會在目標解析度建立潛在畫布(EmptySD3LatentImage),以正向提示詞與 ControlNet 邊緣引導條件模型,並可選擇性地將負向提示歸零(ConditioningZeroOut)以簡化流程。經過取樣(KSampler)後,結果會解碼為 RGB(VAEDecode)、預覽(PreviewImage),並儲存(SaveImage)。ImageScale 用於將 Canny 邊緣圖縮放至與輸出尺寸一致,確保對齊。此設計適合需要強大構圖控制(如維持輪廓或產品外型),同時讓 SD 3.5 處理細節、質感與風格。
API
Use this workflow from code
Every Comfy workflow is a JSON graph. The payload below is this workflow, exactly as ComfyUI runs it — fetch it from the URL, keep it in version control, or load it in ComfyUI and run it node by node.
Run it from TypeScript or Python with the Comfy SDK. The same code targets Comfy Cloud or a ComfyUI you host yourself — only the base URL changes.
// Install (beta)
npm i @comfyorg/sdk
// Run "SD3.5大型Canny ControlNet" (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("sd3.5_large_canny_controlnet_example_api.json");
const asset = client.assets.fromFile("input.png");
wf.setInput("45", "image", asset); // LoadImage
wf.setInput("6", "text", "crystal pink dragon on a blue mystery sky, hyperdetailed"); // CLIPTextEncode
const job = await client.run(wf);
await job.getOutputs("9")[0].toFile("output.png"); // SaveImageThe SDK takes a workflow in API format: open this workflow in ComfyUI and use File → Export Workflow (API).
Comfy Cloud API access requires a plan with an API key.
常見問題
















