小珠光图像-蒙版预览
See your mask over your image before you commit to inpainting
- image
- mask
- composite
The single most common inpainting mistake is not checking the mask. You paint a region, run a 30-step inpaint, and discover the mask covered the wrong thing - or was inverted, or was 100% opacity when you wanted a feather. 小珠光图像-蒙版预览 (Xiaozhuguang Image Mask Preview) is the node that kills that whole class of wasted runs: it composites your mask over your image as a colored overlay and hands you the result as a regular IMAGE. Look at it before you commit.
Unlike a preview node, this one returns the composite as data - wire it into a save node, a compare node, or even back into a pipeline. It's the 小珠光-optimized take on kjnodes' ImageAndMaskPreview, and the source is explicit about the optimization: a single alpha blend instead of the generic composite, which the author claims is measurably faster with zero preview-disk overhead.
How it works
Three cases, all handled: image only → passed through unchanged; mask only → rendered as grayscale RGB; both → the mask becomes an alpha layer, colored by mask_color at mask_opacity, blended over the image with one image*(1-a) + color*a pass. invert_mask flips the mask before compositing, which is the fastest way to discover your mask is backwards without a full inpaint run. mask_color accepts R, G, B, R, G, B, A, or hex (#RRGGBB / #RRGGBBAA), so you can use a semi-transparent red overlay like every image editor on earth.
The inputs that matter
image- optional. The base image.mask- optional. The mask to overlay.mask_opacity- overlay strength, 0–1.mask_color- overlay color, with optional alpha.invert_mask- flip the mask before compositing.
Output: composite (IMAGE). Wire it anywhere an IMAGE goes.
Install
From the ComfyUI-xiaozhuguang pack - Manager (search "ComfyUI-xiaozhuguang"), or:
cd ComfyUI/custom_nodes/
git clone https://github.com/xiaozhuguang/ComfyUI-xiaozhuguang.git
Restart. No dependencies beyond torch + PIL.
Gotcha
The composite is a rendered image - the mask is baked into pixels, so don't feed this output back into an inpaint node expecting it to use the original mask. That's what the actual MASK port is for. And because both inputs are optional, an unconnected image with only a mask gives you a grayscale blob that can look like a bug until you remember the rule. For the classic workflow - "am I about to inpaint the wrong region?" - wire both and leave opacity at 1.0, color at red.
Inputs (5)
| Name | Type | Default | Description |
|---|---|---|---|
| mask_opacity | FLOAT | 1.000–1 | — |
| mask_color | STRING | 255, 255, 255 | RGB (255,255,255) 或 RGBA (255,255,255,128) 或 Hex (#RRGGBB / #RRGGBBAA) |
| invert_mask | BOOLEAN | false | — |
| imageopt | IMAGE | — | |
| maskopt | MASK | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| composite | IMAGE | — |