Krea 2 Reference Encode
The node that finally gives Krea 2 reference images (the way Krea's website does)
- clip
- image1
- image1_mask
- image2
- image2_mask
- image3
- image3_mask
- image4
- image4_mask
- bg_removal
- CONDITIONING
You know the ChatGPT trick - "the character from Picture 1, in the exact art style of Picture 2" - where the model actually does it? That's the whole job of this node. Krea's hosted product has a style-reference and moodboard module that Krea explicitly refused to open-source, so KonokoAz built the local replacement: Krea 2 Reference Encode feeds up to four images into Krea 2 as native vision tokens. No API call, no key, no img2img - it's all happening inside the text encoder.
How it actually works
Krea 2's text encoder is Qwen3-VL-4B, a vision-language model, and the DiT conditions on 12 tapped hidden states of it. Because the encoder can already see, this node doesn't need a reference-latent pathway like Flux Kontext does - it just interleaves your images into the prompt as vision tokens (Picture 1: <|vision_start|><|image_pad|><|vision_end|>), and the model reads character, style and pose from the same hidden states it was trained on. That's also the catch: it only works if your text encoder is the bf16 qwen3vl_4b build. The fp8 conversion breaks the vision tower, so references silently do nothing.
The inputs that matter
clip- yourCLIPLoaderset to typekrea2, loaded with the bf16 Qwen3-VL encoder. Non-negotiable.prompt- this is where the magic lives. Roles come from the prompt itself:character1..character4mark identity references,style1..style4mark style-only ones, and both expand into the exact clauses the reference LoRA trains on. So"The character1 driving a car in the style2"is a complete prompt, no extra wiring. Plainimage1/Picture 1addressing also works, and any connected image you never mention gets a role clause appended automatically so it's not ignored.image1..image4- the references, straight out ofLoad Image.imageN_detail- longest side in pixels before the vision encoder: low/normal/high/max = 256/512/1024/1280. More pixels = more vision tokens = a more literal, stronger reference. Use high for the character/subject, low/normal for pose or style hints.imageN_maskandbg_removal- both crop the reference to the subject and white out the background before encoding, so messy references (scenes, watermarks, stray characters) only contribute the actual subject. Wire aLoadBackgroundRemovalModel(birefnet) intobg_removaland every content-role image is cleaned automatically; style images are left alone, because their background often is the style.layout_split- the first fraction of denoise steps sees text-only conditioning. Set 0.25 and the layout locks in before the reference tokens can drag it into a side-by-side collage. It's a good zero-shot fix, but the LoRA makes it mostly unnecessary.
The single output is CONDITIONING, which goes into the positive input of your KSampler.
Install and gotchas
cd ComfyUI/custom_nodes
git clone https://github.com/KonokoAz/ComfyUI-Krea2-Reference
Restart ComfyUI (or grab it via Manager by searching "Krea 2 Reference"). It's a pure node pack - no Python dependencies to install. The models are the real cost: a Krea 2 checkpoint (UNETLoader), the bf16 qwen3vl_4b encoder (CLIPLoader, type krea2), and qwen_image_vae (VAELoader). If you're new to Krea 2, those three files are exactly what people routinely forget.
Where people get burned: the Encode node alone produces white-background character-sheet collages - you need the companion reference LoRA loaded too, which is the whole point of Krea2ReferenceLoraLoader in the same pack. Use 1024×1024 (wide canvases encourage figure duplication), and if you're on Turbo at CFG 1.0, don't be surprised the negative prompt is skipped - that's not a bug. Reference colors are character identity here, so to restyle an attribute, change it in the reference, not the prompt.
Inputs (16)
| Name | Type | Default | Description |
|---|---|---|---|
| clip | CLIP | — | |
| prompt | STRING | Roles come from the prompt: character1..4 = identity reference, style1..4 = style-only (patches shuffled). Both expand to the clauses the LoRA trains on. Plain image1..4 / Picture 1..4 also work, e.g. 'Redraw the character from image1 in the pose of image2'. | |
| image1opt | IMAGE | — | |
| image1_detailopt | COMBO | high | Longest side this reference is scaled to before the vision encoder. Higher = more vision tokens = stronger, more literal reference. Use high for the character/subject and low/normal for pose or style hints to avoid side-by-side collages. |
| image1_maskopt | MASK | Optional subject mask (e.g. from RemoveBackground). The reference is cropped to the mask's bounding box and the background is whited out before the vision encoder, so messy references (scenes, watermarks, other characters) only contribute the subject. | |
| image2opt | IMAGE | — | |
| image2_detailopt | COMBO | high | Longest side this reference is scaled to before the vision encoder. Higher = more vision tokens = stronger, more literal reference. Use high for the character/subject and low/normal for pose or style hints to avoid side-by-side collages. |
| image2_maskopt | MASK | Optional subject mask (e.g. from RemoveBackground). The reference is cropped to the mask's bounding box and the background is whited out before the vision encoder, so messy references (scenes, watermarks, other characters) only contribute the subject. | |
| image3opt | IMAGE | — | |
| image3_detailopt | COMBO | high | Longest side this reference is scaled to before the vision encoder. Higher = more vision tokens = stronger, more literal reference. Use high for the character/subject and low/normal for pose or style hints to avoid side-by-side collages. |
| image3_maskopt | MASK | Optional subject mask (e.g. from RemoveBackground). The reference is cropped to the mask's bounding box and the background is whited out before the vision encoder, so messy references (scenes, watermarks, other characters) only contribute the subject. | |
| image4opt | IMAGE | — | |
| image4_detailopt | COMBO | high | Longest side this reference is scaled to before the vision encoder. Higher = more vision tokens = stronger, more literal reference. Use high for the character/subject and low/normal for pose or style hints to avoid side-by-side collages. |
| image4_maskopt | MASK | Optional subject mask (e.g. from RemoveBackground). The reference is cropped to the mask's bounding box and the background is whited out before the vision encoder, so messy references (scenes, watermarks, other characters) only contribute the subject. | |
| bg_removalopt | BACKGROUND_REMOVAL | Optional: connect Load Background Removal Model (birefnet) and every content-role reference is auto-cleaned — cropped to its subject with the background whited out. Per-image masks override it; style-role images are left untouched (their background often carries the style). | |
| layout_splitopt | FLOAT | 0.000–0.9 | Fraction of the denoise steps that see TEXT-ONLY conditioning before the references kick in. The first steps fix the layout, so 0.25 strongly prevents side-by-side collages of the references. 0 disables. |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| CONDITIONING | CONDITIONING | — |