Nodes/ComfyUI-YCNodes/YC Mask Color Overlay
ComfyUI Node

YC Mask Color Overlay

Paint your mask onto the image — the fastest way to see (and abuse) what you're masking

By yichengup·Created 2 years ago·Updated 4 months ago· 48
YC Mask Color Overlay
  • image
  • mask
  • IMAGE
color#FF0000
opacity1.00

Takes an image, a mask, and a color, and tints the masked area that color at the opacity you choose. On the surface it's a visualization helper - "show me what this mask covers" - and it's genuinely good at that. But the more interesting use is as a controlled edit: flood the masked region with flat color before sending it to a sampler, and you've built the modern equivalent of the old "fill" mask mode by hand.

What it's actually for

Two jobs. The first is debugging: when a mask is wrong, you want to see it wrong against the actual image, not against a black rectangle. Overlay red at full opacity and the bad boundary is obvious. The second is generation prep: the inpainting playbook notes that to force a large change you overwrite the masked pixels with flat white or grey so the model has to invent rather than lean on what's there. This node is the "overwrite the masked pixels" step, with the color and intensity as knobs.

How it works

Plain per-pixel blend. The masked region gets tinted with your hex color, weighted by opacity:

result = image × (1 − mask × opacity) + color × mask × opacity

Opacity 1.0 makes the masked area the solid color. Opacity 0.3 leaves the image visible under a color wash. The mask acts as a weight map, so soft (blurred) masks produce soft tinted edges - which makes it a nice preview of exactly how a feathered mask will behave in the sampler.

Inputs and outputs

Three inputs, all worth touching:

  • image - what you're tinting
  • mask - which pixels get the color (white = tinted)
  • color - hex, default #FF0000
  • opacity - 0 to 1, default 1

Output is a single IMAGE. It's a transform, not a composite, so you can feed the result straight into the next node.

Install

Ships in ComfyUI-YCNodes. ComfyUI Manager → search "ComfyUI-YCNodes" → install, restart. Or manually:

cd ComfyUI/custom_nodes
git clone https://github.com/yichengup/ComfyUI-YCNodes

Standard pack deps - torch, numpy, pillow, opencv-python, scipy - and no model files.

Where people get burned

  • A mask in the wrong shape. If your mask has a batch or channel dimension it doesn't expect, you can get indexing errors or silently per-batch misbehavior. It expects the usual ComfyUI MASK tensor; when in doubt, squeeze to 2D before wiring it in.
  • Expecting it to composite over transparency. This replaces masked pixels within the image; it doesn't add an alpha layer. For an actual matte overlay you'd need a composite node.
  • Treating it as a mask editor. It changes the image, not the mask. If your goal is "fix the mask," this tints pixels - use it to see the problem, then fix the mask upstream.

It's a small node with two distinct lives: a debugging overlay for mask work, and a blunt instrument for forcing regeneration in masked areas. Both are worth having around.

CategoryYCNode/Image

Inputs (4)

NameTypeDefaultDescription
imageIMAGE
maskMASK
colorSTRING#FF0000
opacityFLOAT1.000–1

Outputs (1)

NameTypeDescription
IMAGEIMAGE