Flux.2 Klein KV: Image Edit - After
Flux.2 Klein KV: Image Edit - Before

This ComfyUI workflow, titled 'Flux.2 Klein KV: Image Edit', is designed to facilitate the editing of images by leveraging reference images and text prompts. It utilizes the advanced Flux.2 Klein model to generate multiple edited images efficiently. The workflow integrates several nodes, including LoadImage and SaveImage for managing input and output, and KSamplerSelect and SamplerCustomAdvanced for refining the sampling process. One of the key features of this workflow is its ability to cache image data, which significantly speeds up processing times when generating variations of an image. This is particularly useful in scenarios where multiple iterations are needed to achieve the desired result.

Technically, the workflow employs a combination of nodes such as the VAEDecode for decoding latent images, RandomNoise to introduce variability, and UNETLoader and VAELoader for loading necessary model components. The CLIPLoader and CLIPTextEncode nodes are used for text prompt encoding, which allows for precise control over the image editing process based on textual descriptions. The Flux2Scheduler and CFGGuider nodes are pivotal in managing the image generation schedule and guiding the conditional generation process. This workflow is highly beneficial for tasks that require detailed image alterations based on specific references and prompts, making it a powerful tool for artists and designers looking to enhance or modify images creatively.

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.

546732126bf6.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.

FAQ

Frequently Asked Questions