π Mask β Transparent Color
Turn a mask into a colored RGBA overlay
- mask
- rgba_image
Masks are grayscale, which makes them awkward to actually look at - a white blob on black tells you where the mask is but not much else. This node converts a mask into an RGBA image where the masked area is a solid color of your choosing and everything else is transparent. Now you've got a colored overlay you can composite on top of the original image to see exactly what your mask is covering, or use as a flat color layer in a compositing stack.
It's a small utility, but a genuinely handy one for two things: debugging (is my mask actually where I think it is?) and compositing (drop a semi-transparent colored region onto an image for a highlight, a tint, or a visual annotation). Anywhere you want a mask to become a visible, colored, transparent-background layer, this is the one-node conversion.
How it works
It reads the mask and builds a 4-channel RGBA image: wherever the mask is active it writes your chosen color into the RGB channels and makes the alpha opaque; wherever the mask is empty the alpha goes transparent. The result is an image you can overlay on anything and only the masked region shows up, painted in your color. Because it respects the mask's grayscale values, soft mask edges become soft alpha edges - a feathered mask gives you a feathered overlay, not a hard cutout.
The inputs and outputs
- mask - the mask to colorize.
- color_hex - the fill color as a hex string (default
#FF0000, red). Standard web hex -#00FF00for green,#0000FFfor blue, whatever reads clearly against your image. Red's a sensible default because it stands out against most photos.
The single output is rgba_image (IMAGE) - a 4-channel image with the mask region colored and the rest transparent. Composite it over your source with an overlay/blend node to visualize, or feed it into a layout as a color layer.
Common issues
The color didn't take / it's black. Check the hex string. It needs the # and six hex digits (#FF0000), not a color name and not RGB numbers. A malformed hex falls back or reads as black.
The transparency isn't showing downstream. Not every node respects an alpha channel. If you wire the RGBA output into something that flattens or ignores alpha, you'll lose the transparency - use a compositing node that honors alpha (overlay, composite-with-alpha) to actually blend it onto another image.
I wanted the outside colored, not the inside. This colors the masked region. If you want the inverse, invert the mask first (there are mask-invert nodes in core ComfyUI and most utility packs) and then run it through this.
Edges look soft when I wanted them crisp. That's the node faithfully carrying the mask's feathering into the alpha. If you want a hard edge, threshold the mask to pure black-and-white before this node.
Installing SDVN_Comfy_node
ComfyUI Manager: search "SDVN_Comfy_node" β install β restart. Manual:
cd ComfyUI/custom_nodes
git clone https://github.com/StableDiffusionVN/SDVN_Comfy_node
Then pip install -r custom_nodes/SDVN_Comfy_node/requirements.txt from the ComfyUI root and restart. The pack also has an Overlay Mask Color on Image node if you'd rather do the colorize-and-composite in one step. This node is under π SDVN / π¨ Image Processing.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| mask | MASK | β | |
| color_hex | STRING | #FF0000 | β |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| rgba_image | IMAGE | β |