发型变换器 - After
发型变换器 - Before

发型变换器是一个ComfyUI工作流,让你在决定前预览不同发型和发色。首先用LoadImage导入照片,然后通过ComfySwitchNode和PrimitiveStringMultiline中定义的预设字符串选择发型。选择会与StringConcatenate组合,如有需要,还可通过JsonExtractString从结构化预设块中提取。编辑结果在PreviewAny中显示,并通过SaveImage保存。

核心是一个自定义处理节点(id: d4c06663-cb1a-4a41-a36b-f09c93e55e7e),根据上游输入应用发型/发色变换。CustomCombo用于将图片和文本参数打包为该节点的输入。参数化设计让你只需切换ComfySwitchNode或调整预设字符串即可轻松A/B测试不同造型,原始照片始终保留,仅对头发外观做变化。

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.

fffa07892f17.json
Fetching workflow JSON…

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 this workflow (TypeScript)
import { Comfy } from "@comfyorg/sdk";

const client = new Comfy({ apiKey: "comfyui-..." });
const wf = await client.workflows.fromFile("workflow_api.json");
const job = await client.run(wf);
await job.getOutputs("<output-node-id>")[0].toFile("output.png");

The 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.

常见问题

常见问题

查看所有工作流
Character
Cinematic
Image to Video
Lip Sync
Multiple Angles
Portrait
Style Reference
Style Transfer
Text to Video
Video Generation
Video
Showing 30 of 30 templates