Nodes/KayTool/𝙆 Preview Mask +
ComfyUI Node

𝙆 Preview Mask +

See your mask sitting on the actual image, not floating in the void

By kk8bit·Created 2 years ago·Updated about a year ago· 364
𝙆 Preview Mask +
  • image
  • mask
    invert_maskfalse
    Preview

    A mask that looks perfectly fine floating on its own - a clean white blob on black - can still be completely wrong once it lands on your actual image: offset by a few pixels, covering the wrong object, or inverted so it's selecting everything except what you wanted. Preview Mask Plus is the debugging tool for that gap. It's the deluxe version of the pack's plain mask previewer, and the thing it adds is exactly the thing that matters: it can overlay the mask directly onto your real picture instead of showing it in isolation.

    How it works

    The node offers several preview modes rather than one fixed rendering: overlay the mask on your actual image, view the raw single-channel mask on its own, or drop it against a flat color background (black, white, gray, red, green, or blue). The colored backgrounds aren't just decoration - a faint or thin mask edge that's easy to miss against grayscale gets a lot more obvious against a saturated red or green field. There's also a straightforward invert toggle, useful the moment you're not sure whether "white" means selected or excluded for a given mask source - mask conventions aren't consistent across every node pack, and it's a genuinely common point of confusion.

    The inputs and outputs that matter

    • Preview - which mode to render: none, image (overlay on your picture), mask (raw mask view), or one of the solid colors (Black, White, Gray, Red, Green, Blue). image mode is the one that actually answers "is this mask in the right place," so reach for that first.
    • invert_mask (default off) - flips the mask's values before previewing. The node's own tooltip spells it out plainly: 0->1, 1->0. Flip this on if the preview looks backwards from what you expected.
    • image (IMAGE) - required. The picture to overlay the mask onto when you're in image mode.
    • mask (MASK) - required. The mask you're inspecting.

    Like the plain Preview Mask node, this one has no output sockets - it's a terminal node, purely for looking at things.

    How to install it

    Comes bundled with the rest of KayTool, not standalone. Via ComfyUI Manager: search KayTool, install, restart. Or manually:

    cd ComfyUI/custom_nodes
    git clone https://github.com/kk8bit/KayTool
    

    then restart ComfyUI. No models, no heavyweight dependencies.

    Common issues & troubleshooting

    You only have a mask, no real image handy, and image mode shows nothing useful. image is a required input on this node, so if you're checking a mask on its own without a picture to back it, either wire in any placeholder image or drop back to mask mode (or the plain Preview Mask node, which only asks for a mask at all) - don't fight image mode without an actual image behind it.

    The mask looks inverted from what you expected. Given the node ships a dedicated invert toggle right on the front, this is common enough to be worth checking first: toggle invert_mask and see if the overlay suddenly makes sense. It usually means the mask's white/black convention doesn't match what the node downstream of it assumes.

    Preview shows up somewhere unexpected, or seems to vanish. Previews from this node write to a temporary directory rather than your permanent output folder - same as ComfyUI's own Preview Image behavior - so don't go hunting for these files in your saved outputs; they're meant to be looked at inline and then discarded.

    CategoryKayTool/Mask

    Inputs (4)

    NameTypeDefaultDescription
    invert_maskBOOLEANfalseInvert mask values (0->1, 1->0)
    PreviewCOMBO9 options: none, image, mask, Black, White, Gray, +3
    imageIMAGE
    maskMASK

    Outputs (0)

    No outputs