MaskConditionalPaint
White where your conditioning mask says 'hands off'
- inpainting_mask
- conditioning_mask
- mask
MaskConditionalPaint answers one specific question: "which parts of my image is the refiner actually allowed to change?" It takes two masks and paints white into the inpainting mask everywhere the conditioning mask says the region is not protected.
The mental model matters here, so let's be careful. In ComfyUI, an inpainting mask is white where you want generation to happen (that's the region that gets re-rendered) and black where the original is preserved. The conditioning mask in this node is the opposite idea - it marks the areas you care about keeping, usually with high values. So the logic runs: anywhere the conditioning mask falls in the range 0 to threshold (default 0.2), paint the inpainting mask white, i.e., "free this region for the sampler to rework." The author's own description says it in one line: paint white where conditioning mask is 0 to threshold.
The inputs
- inpainting_mask - your current mask of what's allowed to be regenerated.
- conditioning_mask - the "importance" map. High values = protected, low values = fair game.
- threshold (default 0.2) - the cutoff. Conditioning values at or below this get painted white into the inpainting mask.
One MASK output. That's the whole schema - this is the deliberately simple version. If you need modes, feathering, or a soft blend instead of hard painting, its sibling MaskUpdateInpaintFromConditioning (display name "Mask Hard Blend") is the same idea with mode, smooth_transition, and feather_amount added on.
When you'd actually use it
In TBG's refiner philosophy, tiles and segments can each carry their own protection. Say you've got a complexity map or a segment mask marking the object you want preserved - you don't want the sampler rewriting the face you already fixed, but you do want it free to rebuild the background. MaskConditionalPaint turns "protected here" into "allowed there" in one node, no boolean inversions strung together. It's also handy when a conditioning mask comes from a detection or segmentation pass and you need to translate it into an inpaint-friendly white-on-black mask without hand-editing.
The classic inpainting gotcha applies: if the threshold is set too high, you'll free up regions you meant to protect and the sampler will happily repaint them. Start at 0.2, look at the output mask, and only raise it if the protected areas still aren't being touched.
Installing it
It's part of the TBG ETUR pack:
cd ComfyUI/custom_nodes
git clone https://github.com/Ltamann/ComfyUI-TBG-ETUR
cd ComfyUI-TBG-ETUR
pip install -r requirements.txt
Or ComfyUI Manager → search "TBG" → TBG_Enhanced Tiled Upscaler & Refiner FLUX PRO, restart. For a node this small you're mostly paying the pack's install tax (heavy requirements, daily beta updates) - that's the price of the helpers coming free with the suite.
Troubleshooting
Two things go wrong. First, mismatched mask resolutions: the node resizes the conditioning mask to match the inpainting mask automatically, but if your masks are wildly different sizes the upscaled conditioning map gets mushy - keep them in the same ballpark. Second, the hard paint is genuinely hard: no feather, no ramp. If your refinement shows a visible hard edge where the mask ends, that's this node working as designed, and the fix is to either lower the threshold so less gets painted, or swap to MaskUpdateInpaintFromConditioning and turn on feather_amount and smooth_transition.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| inpainting_mask | MASK | — | |
| conditioning_mask | MASK | — | |
| threshold | FLOAT | 0.200–1 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| mask | MASK | — |