遮罩预览 / Mask Preview
Finally see what your masks actually cover
- image
- mask
- 图像 / Image
A raw mask is a black-and-white image, and if you've stared at one long enough you know it's a terrible way to judge accuracy. Is that white blob actually covering the person, or is it spilling onto the background? Mask Preview exists to make that answer obvious: it composites your mask over the original photo as a colored, semi-transparent overlay and shows you the result directly in the node. That's the entire job, and it's a job worth having a dedicated node for.
It earns its place in two workflows. Debugging - you're chaining a segmentation or inpainting pipeline and you need to see at a glance whether each stage's mask is right before it commits downstream. And comparing - because the color is selectable, you can render two different masks in two different colors and see exactly where they agree and where they disagree. For anyone who has ever trusted a mask blindly and then watched a face get inpainted wrong, this is cheap insurance.
How it works
You feed it the original image and the mask, and it blends the mask onto the image as an overlay. The overlay color comes from mask_color, with seven presets - red, green, blue, yellow, cyan, magenta, white. Pick one that contrasts with the image so the boundary pops. opacity (default 0.5, range 0–1) controls how translucent the overlay is - lower to see more of the underlying photo, higher to make the mask region unmistakable.
It handles the mismatch case automatically, so a mask at a different resolution than the image gets resized to fit rather than crashing your graph. It's also batch-capable and, usefully, it's marked as an output node - it renders its preview in the UI and still passes the composited 图像 / Image on if you want to save it.
Inputs: image, mask, mask_color. Optional: opacity. Output: 图像 / Image - the composited preview, ready to feed a Save node.
Installing it
Part of the RUI-Nodes pack ("Rui-Node🐶") - install once, get the whole set:
cd ComfyUI/custom_nodes
git clone https://github.com/rui40000/RUI-Nodes
cd RUI-Nodes
pip install -r requirements.txt
or via ComfyUI Manager, search "RUI-Nodes", install, restart. Base requirements only - nothing extra.
Where people get burned
Not much to trip on, which is the point of a preview node. The one thing to keep in mind: opacity is global, and at the default 0.5 a busy image can still swallow a thin mask. Crank opacity toward 0.8 when checking hair or thin structures, and switch colors when your mask is close to the overlay color - a red mask on a red-shirt subject is nearly invisible. And if your mask comes out at a wildly different resolution than the photo, the automatic resize is a convenience, not a guarantee of pixel-accuracy - check fine edges before you trust the composite for precision work.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | 作为底图的原图。 | |
| mask | MASK | 要可视化的遮罩,会以彩色半透明叠在底图上。 尺寸与底图不一致时会自动缩放对齐。 | |
| mask_color | COMBO | 红色 / Red | 叠加色。挑一个与画面主色反差大的更容易看清遮罩边界, 例如人像多用红或青,绿植场景避开绿色。 |
| opacityopt | FLOAT | 0.500–1 | 叠加不透明度。 0 = 只见原图,1 = 只见纯色块。 看边缘细节用 0.3~0.5,确认覆盖范围用 0.7 以上。 |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| 图像 / Image | IMAGE | — |