Krea2 AnyPaint Encode
Where the reference, the prompt, and the known image finally meet
- clip
- vae
- semantic_reference
- known_image
- keep_mask
- positive
- latent
Krea2AnyPaintEncode is the node that makes the whole "AnyPaint" idea work without a custom sampler. Everything you set up in Krea2AnyPaintPrepare - the semantic reference, the known canvas, the keep mask - lands here, gets encoded, and comes out as a completely standard LATENT plus CONDITIONING pair that a stock KSampler happily consumes. No special sampler, no final composite node bolted on after the fact.
Why it's structured this way
Krea 2's functional LoRAs aren't style LoRAs - they teach the model an image-conditioning behavior, and they only do anything when their reference path is actually fed. This node is that feed. It does three jobs at once:
- It encodes
semantic_referencethrough the VAE and appends it to the conditioning as reference latents. That's the "clean" visual the attention mechanism keys off. - If
vlm_referenceis on (it defaults to on), it also hands that same reference image to Qwen3-VL through the Krea 2 template's vision tokens - meaning your text encoder literally sees the canvas while it reads your prompt. That's a big chunk of why AnyPaint edits stay coherent with the source. - It encodes
known_imageinto a latent and convertskeep_maskinto a token-alignednoise_maskthat matches Krea 2's patch grid.
The last part is the sleight of hand that makes this a normal ComfyUI inpainting latent. During sampling, ComfyUI re-injects the known pixels at every step using the standard formula: known_at_sigma = sigma * initial_noise + (1 - sigma) * known_latent. So the preserved regions are never drifted or re-imagined - they're held fixed through the whole denoise, which is why you don't composite the source back afterward.
The inputs that matter
clip- your Qwen3-VL encoder, loaded withCLIPLoaderusing typekrea2. This is mandatory, not optional; the VLM reference path needs it.prompt- plain natural language, the way you'd prompt Krea 2 anyway. Long and specific beats short.semantic_reference,known_image,keep_mask- all three come straight fromKrea2AnyPaintPrepare. Don't improvise them; the pack's whole design assumes they were built together.vlm_reference- the one toggle worth touching. On by default, and you generally want it on. Flipping it off skips the Qwen3-VL pass and runs on the VAE reference alone, which is faster but visibly less faithful to the source.
Wiring it up
It returns positive (CONDITIONING) and latent (LATENT). positive goes to the KSampler's positive input; latent goes to latent_image. The negative slot is just an empty CLIPTextEncode from the same CLIP - Krea 2 Turbo runs at CFG 1.0, so the negative is a formality the sampler still wants filled.
The rest of the chain follows the pack's example workflow: Load Diffusion Model → Load LoRA (the AnyPaint LoRA) → Krea2AnyPaintModelPatch → KSampler.
Installing it
It ships with alexw5702-afk/krea2-anypaint, so one install covers all three nodes:
cd ComfyUI/custom_nodes
git clone https://github.com/alexw5702-afk/krea2-anypaint
Restart, then put krea2_anypaint_rank32.safetensors in ComfyUI/models/loras. The usual Krea 2 model trio - krea2_turbo_int8_convrot.safetensors, the qwen3vl_4b_fp8_scaled.safetensors text encoder, and qwen_image_vae.safetensors - all have to be present, and you need a ComfyUI build recent enough to load Krea 2 natively.
Where people get burned
Most "the output ignores my source" reports trace back to one of two things: a missing Qwen3-VL text encoder (the pack refuses or drifts without it), or someone loading the LoRA but wiring the encode wrong so the reference never reaches the model. And if you're used to older Krea 2 outpaint packs, resist the urge to stick a registered-outpaint composite node on the end - AnyPaint preserves known pixels during every denoising step, so a final composite just double-crops your result.
Inputs (7)
| Name | Type | Default | Description |
|---|---|---|---|
| clip | CLIP | — | |
| prompt | STRING | — | |
| vae | VAE | — | |
| semantic_reference | IMAGE | — | |
| known_image | IMAGE | — | |
| keep_mask | MASK | — | |
| vlm_reference | BOOLEAN | true | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| positive | CONDITIONING | — |
| latent | LATENT | — |