view_Mask_And_Img
See the mask overlaid on the image before you inpaint
- image
- mask
- images
view_Mask_And_Img composites your mask onto your image at a controllable opacity and shows you the result - the classic "red overlay" mask preview that anyone doing serious inpainting ends up wanting. Where view_mask shows a mask as a flat grayscale image, this one puts the mask where you can judge it: on top of the pixels it's about to affect.
This is the pre-flight check for masked work, and inpainting especially. Masked inpainting only edits what's inside the mask, so every failure mode you'll ever hit - regenerated background, missing subject, seam where there shouldn't be one - traces back to a mask that didn't line up with the image. The fix isn't smarter samplers, it's looking. A mask that's half a pixel off, or flipped, or covering the wrong region is invisible until you overlay it on the actual image. mask_opacity is the whole point: at 1.0 the mask is solid, at 0.3–0.5 you can see the image through it and judge alignment precisely.
How it works
The image and mask inputs are combined and shown on the node face. The mask_opacity slider (0 to 1, default 1) controls how strongly the mask tint shows over the image. The composited result comes out the images output, so you can save it, compare it, or feed it onward. It's an output node, so each run also writes the preview to your output directory like other output nodes do.
The inputs and outputs that matter
mask_opacity(FLOAT, 0–1, default 1) - the required setting. How opaque the mask overlay is. Lower it to see the image through the mask.image(IMAGE, optional) - the image to overlay onto. Leave it empty and you get the mask on its own.mask(MASK, optional) - the mask to visualize.images(IMAGE, output) - the composited preview.
How to install it
Part of the ComfyUI-Apt_Preset pack. Install once via ComfyUI Manager (search "ComfyUI-Apt_Preset") or:
cd ComfyUI/custom_nodes
git clone https://github.com/cardenluo/ComfyUI-Apt_Preset
then run install.bat (Windows) or pip install -r requirements.txt, and restart ComfyUI. No model downloads.
Common issues & troubleshooting
The usual suspects when the overlay looks wrong: image and mask resolution mismatches (resize the mask to the image first), and inverted masks - if the "keep" area is highlighted instead of the "edit" area, flip the mask before you run the sampler. The opacity slider is diagnostic too: crank it to 0.5 and check that the mask edges follow the subject. That ten-second check has saved more bad generations than any sampler setting.
Pack-level caveat, same as every node here: niche pack by a Bilibili-based author, translated README. The recurring real-world failure is IMPORT FAILED for the whole pack when dependencies are skipped - run install.bat, restart ComfyUI, and confirm the PreView nodes load before debugging your masks.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| mask_opacity | FLOAT | 1.000–1 | — |
| imageopt | IMAGE | — | |
| maskopt | MASK | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| images | IMAGE | — |