Nodes/TBG_Enhanced Tiled Upscaler & Refiner FLUX PRO/TBG Krea2 Inpainting Conditioning
ComfyUI Node

TBG Krea2 Inpainting Conditioning

Give Krea 2 a mask, not just a sentence

By Ltamann·Created about a year ago·Updated a day ago· 148
TBG Krea2 Inpainting Conditioning
  • clip
  • vae
  • image
  • inpaint_mask
  • reference_image_1
  • reference_image_1_mask
  • positive
  • negative
  • latent
  • stitched_image
positive_prompt
negative_prompt
vl_modeReference Mask Area + Cropped Input Image Global
input_image_vl_strength0.50
inpaint_mask_vl_strength0.50
reference_image_vl_strength0.50
reference_mask_vl_strength0.50
reference_image_stitchfalse
stitch_mask_shrink16
vl_start_percent0.00
vl_end_percent1.00
layer_weights1,1,1,1,1,1,1,1,1,1,1,1
layer_multiplier1.00

The problem it solves

Krea 2 is a vision-language model, and that's both its superpower and its inpainting problem. Its conditioning path really wants to see the image - you feed the whole frame in and it generates visual tokens that describe what it's looking at. Great for editing, but the unmasked parts of your image drift with every pass, and by the third edit the background has quietly rewritten itself. That's exactly the failure mode masked inpainting was invented to kill.

This node is the "mask-first" version of Krea 2 conditioning. It VAE-encodes your image through the mask so only the painted region gets regenerated, and separately encodes visual tokens of just what you want preserved - the masked area, a reference crop, or a bit of both - into the positive conditioning. Bit-identical pixels outside the mask, full generation budget inside it. That's the whole deal, and it's worth having in a landscape where instruction-edit models keep smearing the rest of the frame.

How it works

Under the hood it builds a real latent inpaint. The image goes through the vae, the mask becomes a concat latent plus a noise mask attached to the returned latent, and the split-aware sampler in this pack respects it (more on that in its own article). On the conditioning side, it runs the selected pixels through Krea 2's Qwen3-VL text encoder to produce visual tokens - all local, no API call, no key - and merges those with your text prompt, with per-layer scaling you can tweak if you're brave. Same trick the full ETUR tiler uses, packaged standalone.

Two inputs matter more than the rest:

  • vl_mode - which pixels become visual tokens. Full Input Image is the whole frame (the drift-prone default). Input Mask Area is just the region you're regenerating. Reference Mask Area uses a second image you supply. The default, "Reference Mask Area + Cropped Input Image Global", is the img2img pick: global context from the full frame, explicit tokens only from the masked zone.
  • The four _vl_strength sliders - how loudly those visual tokens speak. 0.5 is a sane starting point. Push toward 1.0 when you want the model to copy what it sees; back off when you want it to improvise.

Optional reference_image_1 (plus a reference_image_1_mask) points at a second source - say, a reference face - and reference_image_stitch physically splices that crop into the inpaint area with a feathered multi-scale Laplacian composite before encoding, handy when you want the model to continue from reference pixels. vl_start_percent / vl_end_percent control when during sampling the visual tokens act; leave them at 0→1 unless you're fine-tuning. The layer_weights / layer_multiplier pair scales the VL tokens per transformer layer - genuinely advanced, defaults are fine.

Outputs and wiring

You get positive and negative CONDITIONING, a latent with the noise mask baked in, and stitched_image - an IMAGE preview of exactly what went into the encode, which is gold for debugging. Wire the conditioning and latent into the pack's TBG_SplitAwareInpaintSampler (that's the node that honors the VL schedule), then a VAE Decode.

Installing it

This is a standalone "takeaway" node inside the TBG ETUR pack, so you install the whole pack. ComfyUI Manager → search "TBG" → install TBG Enhanced Upscaler and Refiner, or:

cd ComfyUI/custom_nodes
git clone https://github.com/Ltamann/ComfyUI-TBG-ETUR
cd ComfyUI-TBG-ETUR
pip install -r requirements.txt

Then restart. Two gotchas: requirements.txt is a heavy lift (timm, kornia, bitsandbytes, optimum, qwen-vl-utils...), and the pack runs on ComfyUI's v3 node API, so it needs a current ComfyUI. You also need the Krea 2 model itself - weights are on Hugging Face (krea/krea-2), free commercially under $1M revenue, license acceptance required. Load its Qwen3-VL text encoder into clip and the Qwen-Image VAE into vae. Plugging a plain CLIP-L into clip gives you text-only conditioning - no visual tokens, no point to this node.

Common issues

  • Mask behavior that seems ignored: reference-based vl_modes want reference_image_1 connected; without one the node quietly falls back to encoding the full input.
  • Batch errors: it raises if your image and mask batch counts don't line up - keep them 1:1.
  • Refusals: Krea 2's open weights shipped with an alignment pass, and its refusal filter flattens some expressions and drops prompt clauses. No conditioning node fixes that; it's baked into the weights.
  • It's brand new (shipped in pack v1.2.12) and thin on docs. Treat your first results as a baseline, not gospel - this page is probably the first thing to mention it.
CategoryTBG/Krea2 Inpainting

Inputs (19)

NameTypeDefaultDescription
clipCLIP
vaeVAE
imageIMAGE
positive_promptSTRING
negative_promptSTRING
vl_modeCOMBOReference Mask Area + Cropped Input Image GlobalGlobal encodes the full input image for complete composition and scene context. Cropped Global also starts from the full input image, preserving its semantic features, colors, and composition, but keeps explicit visual tokens only from the active mask area for stronger local detail; this is useful for img2img refinement. Mask Area uses full-size gradient pixel masking with neutral gray outside the mask.
input_image_vl_strengthFLOAT0.500–1
inpaint_mask_vl_strengthFLOAT0.500–1
reference_image_vl_strengthFLOAT0.500–1
reference_mask_vl_strengthFLOAT0.500–1
reference_image_stitchBOOLEANfalseWhen enabled, crops the reference mask area, scales it to fill the input inpaint area, and inserts it with a feathered multi-scale Laplacian composite before VAE encoding and VL conditioning.
stitch_mask_shrinkINT160–256Erodes the inpainting mask before reference stitching. 16 means the stitch stops about 16 pixels inside the original mask boundary. The original inpainting mask remains unchanged.
vl_start_percentFLOAT0.000–1
vl_end_percentFLOAT1.000–1
layer_weightsSTRING1,1,1,1,1,1,1,1,1,1,1,1
layer_multiplierFLOAT1.000–10
inpaint_maskoptMASKOptional gradient inpaint mask. If disconnected, the full input image is used as the active area.
reference_image_1optIMAGE
reference_image_1_maskoptMASKOptional reference crop mask. If disconnected, the complete reference image is encoded.

Outputs (4)

NameTypeDescription
positiveCONDITIONING
negativeCONDITIONING
latentLATENT
stitched_imageIMAGE