ComfyUI-Krea2-Reference

Reference images for Krea 2 in ComfyUI — ChatGPT-style: "the character from Picture 1, in the exact art style of Picture 2". Character and style transfer through native vision tokens, not img2img.

Krea 2's text encoder is Qwen3-VL-4B, a vision-language model. This node interleaves your reference images into the prompt as native vision tokens (Picture N:), so the DiT reads character/style information from the same hidden states it was trained on. Paired with the reference LoRA (below), the model follows the scene text instead of collaging the reference.

Examples

All images generated with Krea 2 Turbo (8 steps, cfg 1.0) + this node + krea2_reference_v1 LoRA (layered: text 1.0 / dit 0.0), from one root character generated by Krea 2 itself:

Root character (text-only) Watercolor Retro 90s cel 4-panel comic
root watercolor retro comic

Same braid, star hairpin, freckles, bell choker, sunflower dress, cat backpack — across styles and panels.

Drag & drop: every PNG in examples/ embeds its full ComfyUI graph. Drop examples/style_watercolor.png into ComfyUI to get the base reference workflow (Load Image → Krea 2 Reference Encode → layered LoRA → KSampler).

Install

cd ComfyUI/custom_nodes
git clone https://github.com/<user>/ComfyUI-Krea2-Reference

Models (ComfyUI format): Krea 2 checkpoint (UNETLoader), qwen3vl_4b bf16 text encoder (CLIPLoader, type krea2 — fp8 breaks the vision tower), qwen_image_vae (VAELoader). Download the reference LoRA from Civitai / Hugging Face and put it in models/loras/.

Nodes

Krea 2 Reference Encode (TextEncodeKrea2Reference)

Prompt + up to 4 reference images. Refer to them as Picture 1..4 (or image1..4 — auto-normalized). Images connected but not mentioned get a role clause appended automatically.

Input Description
imageN_detail vision tokens per ref: low/normal/high/max = 256/512/1024/1280px. High for characters, low for style/pose hints
imageN_role content (identity) or style (32px grid patch-shuffle: destroys the subject, keeps the style)
imageN_mask crop to mask bbox + white-out background before encoding
bg_removal wire LoadBackgroundRemovalModel: auto-cleans content refs
layout_split first fraction of steps conditioned on text only (0.25 kills collage layouts zero-shot; unnecessary with the LoRA)

Krea 2 Reference LoRA (layered) (Krea2ReferenceLoraLoader)

Loads krea2_reference_v1.safetensors with independent strengths per layer group. Reference addressing, anti-bleed and style transfer live in the conditioning path (text_fusion/txt_in); the DiT-block tensors mostly add identity drift.

  • strength_text 1.0 + strength_dit 0.0 — recommended. Base model rendering untouched, references followed. Best identity, best for comics.
  • Raise strength_dit to ~0.3 for extra scene adherence on hard prompts.
  • A regular LoraLoaderModelOnly at strength 0.7–1.4 also works (single knob, slight identity drift at high strength).

Krea 2 Apply Style Tokens (Krea2ApplyStyleTokens)

Pooled style tokens appended to the conditioning: a leak-proof global palette/mood dial (weak by design; negative strength = anti-style).

Reference LoRA v1

Trained on ~2.7k reference-following triplets (teacher-generated character sets, judged for consistency by Qwen3-VL). What it fixes vs zero-shot:

  • Scene text followed instead of ignored (no more white-background character-sheet collages).
  • "the character from Picture 1" / "in the exact art style of Picture 1" addressing.
  • Style transfer decouples the reference's palette/layout from the scene.
  • Plain text-to-image unaffected (ref-dropout training rows).

Known limits (v2 in progress): character-sheet references induce multi-view clones (use single-pose refs); style refs strongly tied to a franchise drag their cast along; two-reference prompts (character + style) work only partially.

Tips

  • CFG 1.0 on Turbo skips the negative prompt entirely — it's not a bug.
  • Wide canvases encourage figure duplication; 1024×1024 is the sweet spot.
  • For exact pose: pose image as init latent, denoise 0.70–0.78.
S
Description
No description provided
Readme MIT
22 MiB
Languages
Python 100%