Preview Image & Mask
Eyeball a mask against its image before you burn a sampling pass on it
- image
- mask
- images
Masks are invisible until something goes wrong with them. You threshold a segmentation, or draw a rough selection, or pull one out of another node entirely, and it's genuinely hard to tell just by looking at the graph whether that mask actually lands where you think it does. ZwngPreviewImageAndMask solves that in the most direct way possible: it paints the mask on top of the image, right there in the node, so you can see the overlap before you commit a slow pass to it.
How it works
It's a terminal node, the kind you drop at the end of a chain rather than wire onward. Feed it an image and a mask and it composites the mask over the image at whatever opacity you set, so the masked region shows up as a visible tint rather than something you have to infer. It also saves the result to your ComfyUI output folder as it runs, so it doubles as a lightweight save node on top of being a preview.
The inputs and outputs that matter
One required field: mask_opacity, a float from 0 to 1 (default 0.5) that controls how strongly the mask paints over the image. Push it toward 1 if you want to see the exact edge of the mask clearly; ease it toward 0 if you still want to make out detail underneath.
Both image and mask are optional inputs, which just means ComfyUI won't complain if you leave one disconnected. Leave either one out, though, and there's not much left to preview, so in practice you'll want both wired in. The output is images, the composited result, useful mainly as a visual check rather than something you'd typically chain further.
Where this earns a place in a graph is right after anything that produces a mask you haven't visually confirmed yet: a Photoshop-selection bridge, a segmentation node, a rough hand-painted mask, anything where "is this actually covering what I think it's covering" is a real question. Catching a misaligned mask here costs you nothing; catching it after a full sampling pass costs you the GPU time.
How to install it
Via ComfyUI Manager: search "ComfyUI_Zwng_Nodes" or "Zwng", install, restart. Or clone it manually:
cd ComfyUI/custom_nodes
git clone https://github.com/za-wa-n-go/ComfyUI_Zwng_Nodes
then restart ComfyUI. No model files, no extra Python packages, it's a small utility node and installs as one.
Common issues & troubleshooting
Preview shows up blank. Because image and mask are optional, ComfyUI will happily run this node with one or both disconnected instead of throwing an error. If the preview looks empty, check both wires first before assuming anything else is broken.
Overlay is too faint or too solid to actually judge. That's just mask_opacity. There's no "correct" value, it depends on how visible you need the underlying image to stay; nudge it up or down until you can actually judge the alignment.
Output folder filling up with extra files. Since this node saves every time it runs, just like the built-in Preview Image node, expect a new file per test run. That's expected behavior, not a leak, but it's worth knowing if you're wondering where a pile of intermediate mask-check images came from.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| mask_opacity | FLOAT | 0.500–1 | — |
| imageopt | IMAGE | — | |
| maskopt | MASK | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| images | IMAGE | — |