Nodes/ComfyUI/Preview Mask
ComfyUI Node Runs on cloud

Preview Mask

Preview Mask

By Comfy-Org·Created 4 years ago·Updated 16 days ago· 121,575
Preview Mask
  • mask

    Masks are invisible until you look at them, and in ComfyUI they're a separate data type from images - so you can't just plug a MASK into a normal preview and see it. Preview Mask solves that: it renders any mask as a visible black-and-white image right in the UI so you can actually check what you masked before it wrecks your inpaint. It's the debugging node for anything mask-shaped.

    Why you'd reach for it

    Half of mask troubleshooting is "wait, what does my mask actually look like?" You built it from a segmentation model, a threshold, a blur, or some math, and now your inpaint is touching the wrong area or nothing at all. Dropping a Preview Mask onto the wire shows you the mask as pixels - white where it's active, black where it isn't, gray where it's feathered - and the problem usually becomes obvious instantly. It's the mask equivalent of Preview Image, and in any non-trivial masking workflow you'll want one (or several) wired in while you build.

    How it works

    It takes a mask and writes it out as a viewable image, displaying it on the node. It's an output node - it's a leaf in the graph, an endpoint that renders a result rather than passing data onward. Under the hood it saves the visualization to your ComfyUI output directory, the same way Preview/Save Image do, so it also runs every time the graph executes past that point.

    Inputs and outputs

    One input, mask, and no data outputs - it's a terminal preview, so nothing connects out of it. You just attach it to any MASK wire you want to inspect. Feed it a raw segmentation mask, a blurred mask, an inverted mask, whatever - it'll show you the current state.

    Installing it

    Here's the nice part: it's in ComfyUI core. Preview Mask lives in comfy_extras now, not a custom pack, so a current ComfyUI already has it under the image/mask category - nothing to install. It's another node that started life in cubiq's Essentials pack and got absorbed upstream, which was the pack's whole stated goal ("a temporary repository until the nodes get included into ComfyUI").

    If you're on an older build or a workflow references the Essentials variant, install the pack via ComfyUI Manager (search ComfyUI Essentials) or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/cubiq/ComfyUI_essentials
    

    and restart. Same node either way.

    Common issues

    Very little goes wrong here, since it only displays - but a couple of clarifications. It shows the mask, not the masked image; if you want to see "the image with the mask applied," that's a different composite, not this. Remember it's a real output node, so it does write files to your output folder on each run - harmless, but that's why your output directory fills with mask thumbnails when you're iterating. And if the preview looks all black or all white when you expected detail, that is the finding: your mask is empty or fully filled, which is exactly the kind of bug this node exists to catch.

    Categoryimage/mask

    Inputs (1)

    NameTypeDefaultDescription
    maskMASK

    Outputs (0)

    No outputs