Mask Overlay Comparer
Actually See What Your Mask Covers Before You Sample With It
- image
- mask
- image
- mask
Masks are the part of a workflow you're most likely to trust blindly and regret later. A soft mask from a SAM segmenter or a tagger can have faint gradients, stray specks, and coverage that doesn't match what you think you selected - and a Preview Image node shows you a grayscale blob that's genuinely hard to read against the image. IPT-MaskOverlayComparer fixes the visibility problem: it draws the mask over the actual image and gives you a slider to compare the two views in one place.
It's the mask-tooling equivalent of rgthree's Image Comparer, but purpose-built for exactly this question: "is my mask covering the right region, and does its softness make sense?" The pack's own SAM3 node deliberately outputs non-binarized soft masks, which makes a node like this almost mandatory - you cannot judge a soft mask by squinting.
How it works
Give it an image and a mask. It builds a slider-based preview where one side is the clean background image and the other is the image with the mask overlaid. The rendering rule is the part to internalize: pixels where the mask is 0.0 stay unchanged, pixels where it's 1.0 render black, and in-between values get a blue-tinted overlay. So a fully-masked area reads as a black region, partial coverage reads as blue haze, and you can see at a glance both where the mask is and how soft it is. The mask is visualized with its raw 0.0–1.0 values - no binarization, which is the point.
Both inputs pass through as outputs (image and mask), so the node can sit inline in a graph as a "checkpoint" without changing the data flow. It's an output node, so it works fine as a terminal preview too.
Inputs
image(required, IMAGE) - the background for the preview. With a batched image, only the first item is shown in the comparer.mask(required, MASK) - the soft or binary mask to overlay.
For best results the image and mask should be the same resolution - the tooltip says it plainly, and mismatched sizes make the overlay misleading.
Installing it
Standard pack install:
cd ComfyUI/custom_nodes
git clone https://github.com/kinorax/comfyui-info-prompt-toolkit.git
cd comfyui-info-prompt-toolkit
pip install -r requirements.txt
Restart, or ComfyUI Manager → "ComfyUI-Info-Prompt-Toolkit". ComfyUI 0.17.0+. No models.
Common issues
If you're feeding it a batched image and the preview shows "the wrong frame," remember it only renders the first item - you may need to index to the frame you actually care about. And if the blue overlay looks wrong, check that your mask isn't inverted relative to your expectation; the convention here is mask=1.0 renders black. That's a pipeline convention mismatch, not a bug, and half of "my mask is wrong" complaints turn out to be exactly that. Also, mask=1.0 renders black is worth remembering when you're thresholding: this node shows you the truth, and if the truth is "everything's black," you probably thresholded wrong.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | Background image used for mask preview. When batched, only the first item is shown in the comparer. | |
| mask | MASK | Soft or binary mask used for preview. Fully masked pixels render as black, while softer values are tinted blue. |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| image | IMAGE | — |
| mask | MASK | — |