Nodes/ComfyUI Inspire Pack/Regional Conditioning By Color Mask (Inspire)
ComfyUI Node Runs on cloud

Regional Conditioning By Color Mask (Inspire)

Region conditioning from a painted color map

By ltdrdata·Created 3 years ago·Updated 9 months ago· 805
Regional Conditioning By Color Mask (Inspire)
  • clip
  • color_mask
  • CONDITIONING
  • MASK
mask_color#FFFFFF
strength1.00
set_cond_area
prompt
dilation0

Take Regional Conditioning Simple, swap the mask input for a color map, and you've got this node. Instead of passing a black-and-white mask per region, you paint one color-coded image - red here, blue there - and this node extracts the region by its color, restricts your prompt to it, and outputs a CONDITIONING for a normal KSampler. It's the color-mask authoring flow married to the light, sampler-free style of regional prompting.

This is the combination a lot of people actually want: regional prompting to keep multiple subjects from bleeding into each other, driven by a single painted map instead of a pile of separate masks, and without the overhead of the Impact Pack's per-region sampler. You draw the layout once, then wire one of these per color.

How it works

You give it a color_mask image and a mask_color (hex like #00FF00, or a decimal). It pulls the matching pixels into a mask, encodes your prompt against the clip, and limits that conditioning to the extracted area - the same Conditioning (Set Mask) idea underneath, just with a color-keyed mask. Chain several with a Conditioning (Combine) and feed a standard sampler.

The inputs and outputs that matter

  • color_mask - the single painted color map.
  • mask_color - the color to extract for this region.
  • clip / prompt - encode this region's text.
  • strength - conditioning strength for the region.
  • set_cond_area - default or mask bounds (tighten to the region's bounding box).
  • dilation (optional) - grow or shrink the extracted mask by N pixels; a little positive dilation helps close hairline gaps at region edges.

Outputs: CONDITIONING (combine and sample) and the extracted MASK.

Installing it

Via ComfyUI Manager: search "Inspire Pack", install, restart. Manually:

cd ComfyUI/custom_nodes
git clone https://github.com/ltdrdata/ComfyUI-Inspire-Pack

Restart afterward (pip install -r requirements.txt if you cloned). Like its plain-mask sibling, this one wraps a core ComfyUI feature, so it doesn't require the Impact Pack to function.

Where people get tripped up

Color matching is exact, so the painted map needs flat, pure colors and no anti-aliasing - save it as PNG and paint hard edges, or the blended boundary pixels won't match mask_color and drop out of the region. That edge fraying is exactly what the dilation input is there to paper over; a couple of pixels of dilation reclaims the soft border. And the standing caveat of masked-conditioning regional prompting applies: bounds are soft and some attribute bleed between regions is normal. If you need harder separation, the Regional Prompt By Color Mask node routes the same color map through Impact's regional sampler, which holds bounds better but costs you setup and a slower render.

CategoryInspirePack/Regional

Inputs (7)

NameTypeDefaultDescription
clipCLIP
color_maskIMAGE
mask_colorSTRING#FFFFFF
strengthFLOAT1.000–10
set_cond_areaCOMBO2 options: default, mask bounds
promptSTRING
dilationoptINT0-512–512

Outputs (2)

NameTypeDescription
CONDITIONINGCONDITIONING
MASKMASK