Flux.2 Klein 9B: Image Extend - After
Flux.2 Klein 9B: Image Extend - Before

The 'Flux.2 Klein 9B: Image Extend' workflow is designed to expand and enhance images using the FLUX.2 Klein 9B model. This workflow excels at outpainting, a technique that extends the boundaries of an image while maintaining its original style and content. It leverages a combination of advanced nodes such as SamplerCustomAdvanced, CLIPLoader, and RandomNoise to generate seamless extensions of the input image. By using the ComfyUI-Color-Matcher and comfyui-kjnodes, the workflow ensures color consistency and style coherence, making it particularly useful for artists and designers looking to create expansive compositions from limited source material.

Technically, the workflow begins by loading an image and encoding it into a latent space using the VAEEncode node. The image is then padded using the ImagePadForOutpaint node to create space for the new content. The Flux2Scheduler and UNETLoader nodes work together to generate new image data that blends naturally with the existing content. The process is guided by the CFGGuider and KSamplerSelect nodes, which help refine the image generation based on the input prompts and conditions. Once the outpainting is complete, the VAEDecode node converts the latent representation back into a visible image format, ready for saving or further editing.

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.

templates_doc_workbox_klein_9b_image_extend.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 "Flux.2 Klein 9B: Image Extend" (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"); // SaveImage

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

View all workflows
Showing 30 of 30 templates