Nodes/Painting Coder Utils/Mask Preview 🎭
ComfyUI Node

Mask Preview 🎭

Finally see what your mask actually looks like before it wrecks the image

By jammyfu·Created 2 years ago·Updated about a year ago· 16
Mask Preview 🎭
  • masks
  • masks
  • images
preview_enabledtrue

Masks are the invisible failure mode of inpainting. The pipeline runs, the result looks wrong, and only then do you realize the mask was upside down, feathered to nothing, or covering the wrong half of the image. Mask Preview exists to close that gap: it renders your MASK tensor as a visible image so you can check what you're actually feeding into the inpaint before you queue a batch and burn the time.

It's one of the more genuinely useful nodes in the Painting Coder Utils pack, and it doubles as a pass-through - so it slots into an existing mask chain without you having to rewire anything.

How it works

Give it a masks input and it does two things. First, it converts each mask tensor into a grayscale image (white where the mask is active, black where it isn't) and saves it to ComfyUI's temp/preview output, so you see it in the image feed. Second, it passes both the masks and the rendered images back out as list outputs - so it's also a way to turn a MASK list into IMAGEs other nodes can use.

The preview_enabled boolean (default on) gates the actual preview generation. Flip it off and the node still passes data through, just without writing preview files - handy when you've already verified the mask and don't want to spam your output folder on every run. The front-end also re-queues the node when you toggle it, so previews refresh live instead of going stale.

Inputs and outputs

  • masks - the MASK input (a single mask or a batch).
  • preview_enabled - show the preview image or not.
  • Outputs: masks (passed through as a list) and images (the rendered mask views, as a list).

The pass-through is worth leaning on: drop Mask Preview inline between your mask source and the inpaint node, and you get both a live check and the same masks flowing onward. When you've confirmed everything looks right, you can delete it without touching the rest of the chain.

Where it earns its keep

Any workflow with inpainting, outpainting, or ControlNet mask work - and especially batch jobs where a bad mask gets multiplied across hundreds of generations. A thirty-second look at the preview beats discovering the problem in the 47th output.

Install

ComfyUI Manager → Painting Coder Utils, or manually:

cd ComfyUI/custom_nodes
git clone https://github.com/jammyfu/ComfyUI_PaintingCoderUtils.git

Restart ComfyUI. No models to fetch, no keys - the pack's dependencies (numpy, Pillow, torch, gradio) are already present in a stock install. Previews go to ComfyUI's temp output by default, so they won't pollute your permanent output folder. If an inherited workflow fails to find the node, the pack's v0.3.0 namespace change is why - repair it with the included docs/fix/workflow_fixer.html.

Category🎨Painting👓Coder/🖼️Image

Inputs (2)

NameTypeDefaultDescription
masksMASK
preview_enabledBOOLEANtrue

Outputs (2)

NameTypeDescription
masksMASK
imagesIMAGE