Nodes/ComfyUI-Flux2KontextConditioner/Flux2 Kontext Conditioner
ComfyUI Node

Flux2 Kontext Conditioner

Flux 2 Klein image editing without the three-node dance

By KursatAs·Created 3 months ago·Updated 3 months ago· 2
Flux2 Kontext Conditioner
  • clip
  • vae
  • image1
  • image2
  • image3
  • conditioning
  • output_image1
  • output_image2
  • output_image3
  • latent
prompt
target_resolution1024
alignment16
upscale_methodlanczos
guidance3.5
system_prompt_modenone
image1_strength1.00
image1_resolution1024
image2_strength1.00
image2_resolution1024
image3_strength1.00
image3_resolution1024
vae_tilingfalse
custom_system_prompt

If you've stared at a Flux 2 Klein editing workflow and wondered why "change the shirt" needs four nodes wired in exactly the right order, this is the node that gets rid of the wiring. Flux2 Kontext Conditioner is a one-box replacement for the whole Scale Image to Pixels → VAE Encode → Reference Latent → text encode chain: you feed it a CLIP, a VAE, and up to three reference images, and it hands you a ready conditioning plus the latent to sample from. Klein's Kontext attention is genuinely good at instruction edits - swap a garment, change the lighting, keep the person - but it only behaves when the reference latents are shaped right. This node encodes them correctly so you don't have to.

How it actually works

Under the hood it's the standard Flux 2 recipe, done carefully. Each connected image gets resized to its own imageN_resolution (scaled by area, not squashed), snapped to a multiple of alignment - 16 is the default and the minimum safe value, because the Flux2 VAE compresses spatially 16x - then VAE-encoded into the 16-channel latent the model expects. Each encoded latent is scaled by its strength and appended to the conditioning under the reference_latents key, which is exactly what Klein's attention reads. Your prompt runs through the Qwen3-8B text encoder (clip.tokenizeencode_from_tokens_scheduled, no vision tokens), and the guidance scale is baked straight into the conditioning, which is how CFG-distilled Flux 2 expects to be steered.

One thing the README buries: image1 is special. The latent output is image1's encoded latent, so image1 is both a reference and the starting canvas the sampler denoises. Images 2 and 3 are pure references. If you want to edit from a specific source image, that one goes in slot 1. Connect nothing and no VAE, and the node switches to text-to-image: an empty canvas latent at target_resolution (1024 default) plus plain text conditioning.

The inputs that matter

  • image1 / image2 / image3 + strength + resolution - per-slot control. strength 1.0 is full influence; 0–2 range, above 1 amplifies for stronger style transfer (and artifacts - you've been warned). resolution is the VAE encoding res, default 1024, max 2048.
  • guidance - default 3.5, baked in. Raise it for more prompt adherence, lower for naturalness. Leave it alone until you've got a feel for it.
  • vae_tiling - flip this on at 1536px+ encoding res to cut peak VRAM at the cost of slower encodes.
  • system_prompt_mode - an honest no-op-ish. Flux 2 doesn't natively process system prompts, and the author says the Qwen3 chat-template wrapping only subtly shifts token distribution. Set to none unless you're experimenting.

Outputs: conditioning and latent both go to the KSampler; VAE-decode the result. The three output_image1/2/3 are debug only - wire one to a Preview Image if you want to see what the resize/alignment snapping did. They're not needed for generation.

Installing

ComfyUI Manager, search "ComfyUI-Flux2KontextConditioner", or:

cd ComfyUI/custom_nodes
git clone https://github.com/KursatAs/ComfyUI-Flux2KontextConditioner

Then restart. That's the whole dependency story - it only needs torch, which you already have. The real work is the models: flux-2-klein-9b.safetensors, qwen_3_8b_.safetensors, and flux2-vae.safetensors. Grab all three before you blame the node. Worth knowing: the 9B Klein is BFL's non-commercial tier, same license politics that drove the community to Apache-2.0 editors like Qwen-Image-Edit; if that matters to you, its Apache-2.0 Klein 4B sibling exists.

Where people get burned

The big one is in the README's warning: don't pre-process your images. No Scale Image to Pixels, no VAE Encode, no Reference Latent ahead of this node - plug the raw image straight into image1. Feeding it an already-encoded latent double-encodes and produces garbage. Also, the whole point of this node is keeping the reference-latent plumbing self-contained; hand-rolling conditioning with reference_latents on another node is where people hit cuda/cpu tensor mismatch errors. And remember the KSampler has no decode built in - forgetting the VAE Decode on the other end is a classic 5-minute "why is this blank."

Categoryflux/conditioning

Inputs (19)

NameTypeDefaultDescription
clipCLIP
promptSTRING
target_resolutionINT1024256–2048Text-to-image workflow only. Sets the canvas size (in pixels) for the empty latent passed to KSampler when no VAE or images are connected. Has no effect when VAE is connected — each image slot uses its own image1/2/3_resolution instead.
alignmentCOMBO16Snaps resized image dimensions to the nearest multiple of this value before VAE encoding. 16 is the minimum safe value for the Flux2 VAE (16x spatial compression). Higher values enforce stricter dimension rounding, which may slightly reduce effective resolution but can improve compatibility with some samplers.
upscale_methodCOMBOlanczos5 options: lanczos, bicubic, bilinear, area, nearest-exact
guidanceFLOAT3.50–100Flux2 guidance scale baked into the conditioning. Controls how strongly the model follows the prompt. 3.5 is the recommended default. Higher values increase prompt adherence but may reduce naturalness.
system_prompt_modeCOMBOnoneWraps the prompt with a Qwen3 instruct chat template. Flux2 itself does not process or understand system prompts — however, since Qwen3-8B was trained with these templates, the wrapping can subtly shift the token distribution and influence the final conditioning. Effect is minor. 'none' passes the raw prompt directly.
vaeoptVAE
image1optIMAGE
image1_strengthoptFLOAT1.000–2Scales the encoded latent of image1. 1.0 = full influence. Lower values reduce the reference impact, higher values amplify it. Only active when VAE is connected.
image1_resolutionoptINT1024256–2048VAE encoding resolution for image1. Input image must be equal or higher resolution to benefit. Higher values increase VRAM usage. You may enable vae_tiling
image2optIMAGE
image2_strengthoptFLOAT1.000–2Scales the encoded latent of image2. 1.0 = full influence. Lower values reduce the reference impact, higher values amplify it. Only active when VAE is connected.
image2_resolutionoptINT1024256–2048VAE encoding resolution for image2. Input image must be equal or higher resolution to benefit. Higher values increase VRAM usage. You may enable vae_tiling
image3optIMAGE
image3_strengthoptFLOAT1.000–2Scales the encoded latent of image3. 1.0 = full influence. Lower values reduce the reference impact, higher values amplify it. Only active when VAE is connected.
image3_resolutionoptINT1024256–2048VAE encoding resolution for image3. Lower values reduce spatial detail in the latent. Higher values increase VRAM usage. You may enable vae_tiling
vae_tilingoptBOOLEANfalseEnable VAE tiling for this node only. Reduces VRAM during encoding at the cost of slightly slower processing. Does not affect global ComfyUI VAE settings.
custom_system_promptoptSTRING

Outputs (5)

NameTypeDescription
conditioningCONDITIONINGText + reference-image conditioning passed to KSampler.
output_image1IMAGEDebug: resized image1 after aspect-ratio scaling and alignment snapping. 1×1 black pixel if image1 is not connected. Not needed for generation — wire to a Preview Image node to inspect the resized input.
output_image2IMAGEDebug: resized image2 after aspect-ratio scaling and alignment snapping. 1×1 black pixel if image2 is not connected. Not needed for generation — wire to a Preview Image node to inspect the resized input.
output_image3IMAGEDebug: resized image3 after aspect-ratio scaling and alignment snapping. 1×1 black pixel if image3 is not connected. Not needed for generation — wire to a Preview Image node to inspect the resized input.
latentLATENTLatent passed to KSampler. Contains the VAE-encoded reference latent of image1 when VAE is connected, or an empty canvas latent sized by target_resolution when no VAE is connected.