Krea2 Visual Reference Encode
Steal Krea 2's style reference back from the API
- clip
- style_image
- CONDITIONING
Krea's hosted product has a style-reference feature that's genuinely good: feed it a reference image and the model borrows the medium, palette, lighting and mood while keeping your prompt's subject. It's also the one thing Krea has explicitly refused to open - the style-transfer adapter behind the hosted tool is not in the open weights. This node is a community attempt to rebuild the trick locally, using a loophole Krea probably didn't intend: Krea 2's text encoder is Qwen3-VL-4B, a full vision-language model, and it can see images.
That's the entire premise of Krea2VisualReferenceEncode, the main node in the kevinzilin/ComfyUI-Krea2-VisualRef pack. Set expectations: 0.1.0, one commit, a handful of stars, zero community mileage. It can change your output, do nothing at all, or drag the reference subject into the result. All three are documented outcomes. Treat it as a research tool, not a finished feature.
How it works
Krea 2 conditions on a stack of Qwen3-VL-4B hidden states, exposed through CLIPLoader with type krea2 - it's called a CLIP but it's a vision-language model under the hood. The node reuses that wrapper instead of re-implementing the encoder.
Depending on style_text_mode, it does two different things:
auto_style_text_only(default) - honestly, fancy captioning. Qwen3-VL looks at the reference and writes a structured style description (medium, palette, lighting, texture, mood, negative subjects), the node adds an algorithmic palette hint from the image tensor, fuses multiple references into one "TRANSFERABLE STYLE LOCK", and folds it into your prompt as text conditioning. No image tokens reach the sampler. If the reference subject leaks into output, this is the mode that stops it.auto_style_text_and_visual- the same extraction, plus a full Qwen3-VL chat template with an image block per reference, encoding real visual tokens. You get two conditioning items: the text lock at full strength plus a visual branch scaled to roughly half yourstrength(the code multiplies by 0.54) so it doesn't double-dip.visual_only- no style text. Just the visual-token path witheffective_strength = strength^2.5, so mid values don't swamp your prompt. Closest to what Krea's API does, and most likely to leak the subject.
The inputs that matter
style_image- your reference; optional, and the node is a no-op without it (it falls back to nativeclip.tokenize(prompt)). Batch several and it extracts a style note from each, fusing them into one lock rather than generic mush.style_text_mode- the three-way switch above. Start withauto_style_text_only; move to the visual modes only when you want the image itself influencing the result.strength- 0.0 to 1.0. The README suggests starting at 0.5 or 0.75, and lowering it if the reference overwhelms the prompt or you get collage/panel-style output.placement-before_promptorafter_prompt, where the vision block and guidance sit in the chat template relative to your prompt. Trybefore_promptfirst, then compare.
The single output is CONDITIONING, wired to your KSampler's positive input in place of normal Krea 2 text conditioning: CLIPLoader (krea2) → this node → KSampler positive.
Install
The pack itself is tiny - no pip dependencies, no model files to download. Via ComfyUI Manager, search "ComfyUI-Krea2-VisualRef", or clone it manually:
cd ComfyUI/custom_nodes
git clone https://github.com/kevinzilin/ComfyUI-Krea2-VisualRef
Then restart ComfyUI. The heavy lifting is the Krea 2 stack, which this pack downloads nothing for: the Krea-2 checkpoint, the Qwen3-VL-4B text encoder (~8GB) via CLIPLoader type krea2, and the Qwen-Image VAE (~250MB). You also need a ComfyUI build with Krea2/Qwen3-VL image-token support - 0.25.0 or newer.
Troubleshooting
- "requires CLIPLoader type 'krea2'" - you wired the checkpoint's built-in CLIP instead of the dedicated Qwen3-VL encoder. The node checks the class names and refuses.
- Empty prompt with an image connected - hard error. The reference is only a style source; with no prompt, Krea 2 follows the reference content or its own priors. Type something.
clip.tokenize(..., images=[...])errors - your ComfyUI build predates image-token support. Update ComfyUI.- Feature width isn't 30720 - wrong CLIP again. Krea 2 conditioning is 12 Qwen3-VL layers × 2560, and the node validates it.
- Reference subject bleeding into output - drop to
auto_style_text_only, lowerstrength. The visual-token path is the usual leak source. - No visible effect at all - genuinely possible. Krea 2 may not have been trained to interpret an image token as a style reference; noisy conditioning and a fallback to Krea's default style bias are expected, not your bug.
For shape or metadata questions, wire Krea2VisualReferenceDebug onto the conditioning output - it prints the full picture in text.
Inputs (6)
| Name | Type | Default | Description |
|---|---|---|---|
| clip | CLIP | — | |
| prompt | STRING | a ceramic teapot on a wooden table | — |
| strength | FLOAT | 1.000–1 | — |
| placement | COMBO | before_prompt | 2 options: before_prompt, after_prompt |
| style_text_mode | COMBO | auto_style_text_only | 3 options: auto_style_text_only, auto_style_text_and_visual, visual_only |
| style_imageopt | IMAGE | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| CONDITIONING | CONDITIONING | — |