Nodes/SDVN_Comfy_node/🧩 Overlay Mask
ComfyUI Node

🧩 Overlay Mask

Paint a mask onto an image so you can actually see it

By StableDiffusionVNΒ·Created 2 years agoΒ·Updated about a month agoΒ· 118
🧩 Overlay Mask
  • base_image
  • mask
  • image
β—„color_hex#FF0000β–Ί
β—„opacity1.00β–Ί

A mask by itself is a grayscale blob that's hard to reason about at a glance - is that region actually where you think it is? Does the auto-detected mask from your Yolo Seg Mask node line up with the face you meant? This node answers that by tinting the masked area a solid color and layering it over your actual image, so you can eyeball the mask's coverage directly instead of squinting at a black-and-white preview.

Why this matters for mask-heavy workflows

Anything built around inpainting, segmentation, or region-based conditioning lives and dies by whether the mask is actually covering the right area. A mask that's off by a few pixels, inverted, or picking up the wrong region is one of the most common ways an inpaint workflow produces a confusing result - and a raw mask preview node just shows you white-on-black, which tells you shape but not context. Overlaying the mask directly on the source image in a bright, chosen color turns that into an instant visual check: run it once before your inpaint sampler, look at the preview, confirm the highlighted area is what you meant, then remove the node (or leave it as a QA branch off to the side) once you trust the mask.

The inputs and outputs that matter

  • base_image - the image the mask was generated against.
  • mask - the mask to visualize.
  • color_hex - the tint color, default #FF0000 (red - the obvious high-contrast choice for spotting a region against most photos).
  • opacity - 0–1, default 1 (fully opaque tint). Lower it if you want to still see detail through the highlighted area rather than a flat color block.

One output: image, the base image with the mask tinted and overlaid.

Installing it

ComfyUI Manager: search SDVN_Comfy_node, install, restart. Or:

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 your ComfyUI root, and restart.

Where people get burned

This is a QA/preview node, not a compositing step. It doesn't feed back into your generation - it's for looking at, then routing to a Preview Image node or the like. Don't wire its output into your sampler expecting it to do anything to your actual pipeline; it's a debugging branch, not a functional one.

Full opacity hides what's underneath the mask. At the default opacity: 1, the masked region becomes a flat color block - great for confirming shape and boundary, useless for judging what detail sits inside it. Drop opacity toward 0.3–0.5 if you also want to see the underlying image through the tint.

Mask and image size mismatches. Like most overlay operations, this assumes the mask lines up spatially with base_image. If your mask came from a different resolution step earlier in the graph and wasn't resized to match, the overlay will land in the wrong place - check that the mask and image share dimensions before trusting what you see.

CategoryπŸ“‚ SDVN/🎨 Image Processing

Inputs (4)

NameTypeDefaultDescription
base_imageIMAGEβ€”
maskMASKβ€”
color_hexSTRING#FF0000β€”
opacityFLOAT1.000–1β€”

Outputs (1)

NameTypeDescription
imageIMAGEβ€”