LayerMask: MaskPreview
MaskPreview — actually see the mask you're building
- mask
- images
Masks are invisible in a ComfyUI graph. You wire one up, it flows between nodes, and you have no idea what it actually looks like until it's too late and your composite came out wrong. MaskPreview fixes that: feed it a mask and it shows you the mask as a black-and-white image, right there in the node, and saves a copy to your output folder. It's the mask equivalent of the built-in PreviewImage, and if you do any masking work you'll end up dropping it in constantly.
How it works
A MASK in ComfyUI is a single-channel image - values from 0 (fully out) to 1 (fully in). MaskPreview converts that channel into a viewable grayscale image (white where the mask is solid, black where it's empty, gray in the soft transition zones) and renders it. As the node's own description notes, it also saves the result to your ComfyUI output directory, so you get both a live look and a file.
That grayscale view is the whole value. Seeing the actual falloff at the edges tells you instantly whether a matting pass is working, whether your erode/dilate went too far, or whether the mask is inverted - all things you cannot tell from the connection line alone.
It's especially worth having when you're tuning the Ultra mask nodes in this pack. RmBgUltra V2 and SegformerB2ClothesUltra expose a pile of edge controls - detail_erode, detail_dilate, black_point, white_point - and none of them mean anything until you can see what they do to the boundary. Wire the mask output of one of those into MaskPreview and you get a live grayscale readout of every slider change: too much dilate shows up as a fat halo, a leaking mask shows up as gray where you wanted solid black, a soft hair edge shows up as the smooth gradient you're hoping for. Tune against the preview, then send the mask on to your composite once it looks right.
The inputs and output that matter
mask(MASK) - the mask you want to see. That's the only input.
Output is images (IMAGE) - the rendered grayscale version, which you can route onward if you want to save or process it, though usually you're just looking at the node preview. It's an output node, so it renders whenever the graph runs.
How to install it
ComfyUI Manager: search ComfyUI Layer Style, install, restart. Or:
cd ComfyUI/custom_nodes
git clone https://github.com/chflame163/ComfyUI_LayerStyle
install requirements.txt, restart. Node lives under 😺dzNodes → LayerMask.
Common issues
Almost nothing goes wrong here - no model, no settings. The one "huh?" moment is that it writes files to your output directory every run, same as PreviewImage, so if you're batch-testing masks you'll accumulate a pile of preview PNGs; clear them out periodically. And if the preview looks all-black or all-white when you expected detail, that's not the node failing - that's your mask genuinely being empty or fully solid, which is exactly the kind of bug MaskPreview exists to catch. Which is the point: a boring node that saves you from shipping a broken mask.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| mask | MASK | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| images | IMAGE | — |