Nodes/KJNodes for ComfyUI/Preview Image Or Mask
ComfyUI Node Runs on cloud

Preview Image Or Mask

One preview node for both images and masks

By kijai·Created 3 years ago·Updated 2 days ago· 3,030
Preview Image Or Mask
  • input

    Small node, small job, no drama. The core ComfyUI Preview Image node only takes an IMAGE. If you've got a MASK you want to eyeball, you first have to convert it to an image, which means an extra node and a moment of "wait, which conversion node was it again." PreviewImageOrMask skips that: it takes either type on the same input and shows it to you.

    It's from kijai's KJNodes, the sprawling utility pack that's on most ComfyUI installs. This is one of the throwaway-useful ones, the kind you drop in temporarily while you're debugging and forget to remove.

    How it works

    There's one input, typed to accept both IMAGE and MASK, and it renders whatever you give it in the node's preview area. That's the whole node. It's a terminal preview, meaning it's an output node that displays a result rather than passing anything on. No output slots, nothing to wire forward.

    The reason it earns its place over the stock preview is purely that dual-type input. When you're building a masking or segmentation chain, half the things flowing through your graph are masks, and being able to tap any wire with a single node that "just shows it" regardless of type saves you a surprising amount of fiddling.

    The inputs and outputs that matter

    • input - accepts an IMAGE or a MASK. Plug in whatever you want to look at.

    That's it. There are no outputs; it's a display node. So don't try to route "the preview" onward, there's nothing coming out the other side. If you need the composited or converted result to continue downstream, that's a different node's job (look at ImageAndMaskPreview with pass_through, for instance).

    Installing it

    Most likely you already have KJNodes. If not: ComfyUI Manager → search KJNodes for ComfyUI → install → restart. Manual install:

    cd ComfyUI/custom_nodes
    git clone https://github.com/kijai/ComfyUI-KJNodes
    pip install -r ComfyUI-KJNodes/requirements.txt
    

    Restart ComfyUI. No models, no extra dependencies.

    Common issues

    "There's no output, is it broken?" No, that's correct. It's a preview/display node with zero output slots. It shows the image or mask in place and that's the end of the branch.

    A mask shows up as a flat gray/white rectangle. That's just what a mask looks like when you view it directly, it's a single-channel intensity map. Seeing the gray blob is the preview working. If you want to see the mask overlaid on your actual image so you can judge coverage, use ImageAndMaskPreview instead, which composites the two.

    Nothing appears at all. The input is probably empty, or the upstream node errored before producing anything. Check that the node feeding this one actually ran and has real content.

    CategoryKJNodes/misc

    Inputs (1)

    NameTypeDefaultDescription
    inputIMAGE,MASKThe image or mask to preview.

    Outputs (0)

    No outputs