本ComfyUI工作流采用Stability AI的SD 3.5 Large模型和Canny ControlNet,根据输入图像的边缘结构生成新图像。流程包括加载SD 3.5模型(CheckpointLoaderSimple)和Canny ControlNet(ControlNetLoader),用CLIPTextEncode编码文本提示,并通过Canny节点从参考图提取高对比度边缘图。边缘图通过ControlNetApplyAdvanced作为结构约束,指导KSampler在遵循提示词的同时,生成符合轮廓的新内容。
技术上,工作流会在目标分辨率下创建潜空间画布(EmptySD3LatentImage),用正向提示词和ControlNet边缘引导模型,负向提示默认用ConditioningZeroOut清空(如需负向提示,可自行添加CLIPTextEncode)。采样后(KSampler),结果经VAEDecode解码为RGB,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.
常见问题
















