Nodes/KJNodes for ComfyUI/PreviewLatentNoiseMask
ComfyUI Node Runs on cloud

PreviewLatentNoiseMask

See the inpaint mask you're actually sampling with

By kijai·Created 3 years ago·Updated 2 days ago· 3,030
PreviewLatentNoiseMask
  • latent
  • mask

Inpainting and outpainting in ComfyUI work by attaching a noise mask to your LATENT - usually via a "Set Latent Noise Mask" node upstream - and that mask is invisible for the rest of the pipeline. You can't see it, you can only see its effects, after the fact, in a generation that either inpainted the wrong area or didn't inpaint enough of the right one. PreviewLatentNoiseMask pulls that hidden mask back out as an actual visible MASK so you can check it before you spend a generation finding out it was wrong.

Why this matters more than it looks

A bad inpaint result has two very different possible causes: the model made a bad generation, or the mask covering the region to regenerate was wrong in the first place - too tight, too loose, offset, or accidentally covering nothing at all. Without a way to see the mask directly, those two failure modes look identical from the output alone, and you end up debugging the wrong thing - reworking your prompt or sampler settings when the real problem was the mask never covered what you thought it did. This node collapses that ambiguity: preview the mask, confirm it's actually shaped the way you expect, then worry about generation quality.

It's also just useful as a sanity check any time a latent has passed through several nodes that might have modified its noise mask along the way - resize operations, crop/composite steps, or anything else that touches the latent - where it's easy to lose track of whether the mask survived the trip intact.

The inputs and outputs that matter

  • latent (LATENT) in - any latent that has a noise mask attached to it.
  • mask (MASK) out - the extracted noise mask, ready to view directly (through a standard mask preview/save node) or reuse elsewhere in your graph.

That's the entire node. No settings, no options - it's a read-and-expose operation.

Installing it

Ships with the pack:

  • ComfyUI Manager - search KJNodes for ComfyUI, install, restart.
  • Manual - cd ComfyUI/custom_nodes && git clone https://github.com/kijai/ComfyUI-KJNodes, then pip install -r ComfyUI-KJNodes/requirements.txt, restart.

No dependencies of note, no models - it's a pure extraction utility.

Common issues & troubleshooting

Output is blank, or an error about a missing mask. If the latent you're feeding in never had a noise mask attached - say, it came straight out of a plain VAE Encode rather than an inpainting-specific setup with a "Set Latent Noise Mask" step upstream - there's nothing for this node to extract. Check that the latent genuinely passed through a mask-setting step before this node, not after.

Mask looks right here but the inpaint result still seems off. That's useful information, not a failure - if the mask checks out visually, the problem is somewhere else in the chain (prompt, denoise strength, sampler settings), and you've correctly ruled out the mask as the cause instead of guessing.

Mask looks wrong - smaller, shifted, or missing entirely compared to what you expected. That confirms the mask itself is the problem, and points you back to whatever set it - check the region you drew or generated the mask from, and any resize/crop steps between that point and this node that might have altered or dropped it along the way.

CategoryKJNodes/latents

Inputs (1)

NameTypeDefaultDescription
latentLATENT

Outputs (1)

NameTypeDescription
maskMASK