Mpi Mask Preview
The three-node mask check you keep rebuilding, in one node
- destination
- mask
- image
Every ComfyUI user has built this graph by hand: Empty Image for a colour, Image Composite Masked to punch it through the mask, Preview Image to look at the result. Two of those three nodes exist only to satisfy the third. You build it, you check the mask landed where you thought, you delete it - and you build it again next week.
MpiMaskPreview is that graph collapsed into one node. It paints a flat colour through a MASK onto an IMAGE and previews it in-graph, and it still returns the composited image so you can chain off it if you want to.
It is a debug view, not a compositor, and the input list is where you can see the author making that call. No source, because the whole point is a flat colour rather than a second picture. No x/y, because the mask is already in the plate's coordinates and offsetting it answers a question nobody asked. No resize_source, because there's nothing to resize.
The inputs that matter
destination - the image you're checking against. Your plate, or anything at the mask's resolution.
mask - the mask you're suspicious of.
color - an INT with a colour-picker widget, defaulting to 0 (black). Black is the deliberate default rather than something spicy: a coloured overlay competes with what's underneath for attention, while a dark one reads as shade and lets the plate stay legible through it.
alpha - default 0.70, and this is what makes it a debug tool rather than a compositor. At 1.0 the mask is a solid block and all you learn is its outline. Below it you see what the mask is sitting on, which is the actual question when a mask is landing in the wrong place - a few pixels of chin left out is invisible in a black blob and obvious through a translucent one.
invert_mask - off paints where the mask is white; on paints where it's black. Use it when you're not sure which way round the mask is, or when you're checking that the unmasked region covers everything you need.
index - picks one frame out of a batch, because these masks usually come off video. A 124-frame clip through a normal preview node renders 124 thumbnails and stalls the browser, so this shows one. Negative counts from the end (−1 is the last frame). Out of range clamps to the nearest frame rather than raising - killing a run mid-debug over a preview widget would be the wrong trade, though it does mean a wrong index quietly shows you the last frame instead of complaining.
One behaviour worth knowing when your mask is a single frame and your image is a clip: a mask batch of 1 is treated as one mask for the whole clip, matching how a still mask is used against video elsewhere in the pack. A larger mask batch is indexed alongside the picture.
Output: image - the composited plate with the colour painted through. The node is an output node, so it previews in-graph automatically.
Two choices that keep you from lying to yourself
Resampling is nearest, deliberately not bilinear. If the mask is at a different resolution than the image, it gets scaled with nearest - so a coarse, latent-grid mask still looks coarse here. A smooth resample would make a blocky mask look like a clean soft-edged one, which is precisely the misreading this node exists to prevent.
An empty batch blocks downstream instead of raising. Feed it nothing and the branch stops; you don't get an IndexError from a debug node.
Install
Part of MadPonyInteractive/ComfyUi-MpiNodes. ComfyUI Manager → search ComfyUi-MpiNodes, or:
cd ComfyUI/custom_nodes
git clone https://github.com/MadPonyInteractive/ComfyUi-MpiNodes
Restart, search "Mpi Mask Preview" (MpiNodes/Debug). Nothing to install beyond that - the pack has no requirements.txt, and ComfyUI already ships the numpy/scipy/Pillow it needs. The pack is AGPL-3.0 from v1.2.7 onward. If MpiMaskDebugInfo is the other half of your debugging day, it prints mask shape, dtype and device to the console - this node shows you the pixels, that one tells you what the tensor is.
Where people get burned
Forgetting it's an output node. Output nodes run on every submit, so it's in your execution path, not a free look. It's cheap compared to a sampler, but on a batch it isn't free.
A clamped index looking like a bug. Ask for frame 200 of a 124-frame clip and you get frame 123. No error, no hint. If a preview looks suspiciously like the end of your clip, that's why.
Using it as the compositor. It paints a flat colour. Your actual result still has to go through a real composite - this is the check, not the fix.
Inputs (6)
| Name | Type | Default | Description |
|---|---|---|---|
| destination | IMAGE | — | |
| mask | MASK | — | |
| color | INT | 00–16777215 | Colour painted through the mask. |
| invert_mask | BOOLEAN | false | Off: paint where the mask is white. On: paint where it is black. |
| alpha | FLOAT | 0.700–1 | Paint opacity. 1.0 hides the plate under the mask; lower shows it through, which is how you check what the mask is sitting on. |
| index | INT | 0-18446744073709550000–18446744073709550000 | Which frame of a batch to show. Negative counts from the end (-1 is the last). Out of range clamps to the nearest frame. |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| image | IMAGE | — |