Nodes/ComfyUI-CustomNodePacks/Mask Preview Overlay (MEC) (legacy)
ComfyUI Node

Mask Preview Overlay (MEC) (legacy)

See your matte before you blame the model

By Code2Collapse·Created 8 months ago·Updated a day ago· 58
Mask Preview Overlay (MEC) (legacy)
  • image
  • mask
  • bbox
  • preview
◄display_modeoverlay►
◄overlay_color_r1.00►
◄overlay_color_g0.00►
◄overlay_color_b0.00►
◄opacity0.40►
◄edge_width2►
◄show_bboxfalse►
◄bbox_color_r0.00►
◄bbox_color_g1.00►
◄bbox_color_b0.00►

What it is

A viewer. You give it an IMAGE and a MASK, it gives you back a picture of the two together, and it renders that picture in the graph as an output node. That is the entire job, and it is a job worth having: mask work is where people guess, and guessing is how you spend an hour re-rendering an inpaint you could have fixed in thirty seconds by looking at the matte first.

It is also marked deprecated - kept registered so older workflows load, with the pack's own description pointing at the newer MaskOpsMEC preview output as the current path. Fine for inspection; do not build a production graph around it.

The five display modes

display_mode is the whole node. overlay tints the mask over your image with overlay_color_r/g/b and opacity (0.4 by default) - the classic red wash, and the fastest way to see whether a subject matte actually covers the subject. mask_only shows the raw matte as black and white. side_by_side puts the original next to the masked version, which is how you judge whether the cut-out kept hair or ate the ears. checkerboard puts the mask over a checker pattern, which makes semi-transparent alpha and interior holes obvious in a way a flat fill does not. edge_highlight draws just the contour, edge_width pixels thick.

That last one is the underrated mode. Draw the boundary and zoom in: a ragged, wobbly, blown-out edge is a segmentation problem, while a clean edge with a wrong interior is a threshold or fill problem, and those two need completely different fixes.

show_bbox draws a box around the mask's extent (auto-detected), with its own RGB colour fields. There is also an optional bbox input that overrides the auto-detect - useful when you want to see where a downstream crop node thinks the region is, rather than where the mask happens to peak. The box is what a crop-and-inpaint pipeline will actually cut on, so checking it against the mask is a real pre-flight test.

Output

One preview (IMAGE). It is an output node, so it renders without you having to wire a save - and equally, it cannot be a pass-through in a chain. If you need the pixels downstream, you need a different node.

Install

cd ComfyUI/custom_nodes
git clone https://github.com/Code2Collapse/ComfyUI-CustomNodePacks.git

ComfyUI Manager → search "CustomNodePacks" does the same. Restart, and check for:

[C2C] CustomNodePacks: 142 nodes loaded (...) - 0 failed

Shared requirements are three packages, installed carefully - ComfyUI brings its own torch and numpy, and the pack's README warns you about that for a reason:

pip list | grep -i "opencv\|scipy\|safetensors"
pip install opencv-python>=4.7.0 scipy>=1.10.0 safetensors>=0.4.0

Where people get burned

  • Batch mismatch confusion. The node expands or repeats inputs to make the batch sizes line up, so a still image against a 30-frame mask sequence gives you thirty previews rather than an error. That is convenient until you wonder why a 300-frame load looks like one frame.
  • It is a viewer, not a compositor. Nothing here changes your pixels or your mask. If you want the tinted result as an image to save, you are looking for a compositing node.
  • Screenshotting the node preview then re-importing it is a genuinely common mistake - it is 8-bit, resized to fit the canvas, and has nothing to do with the data the sampler gets. Look, do not copy.
  • Deprecated, so quiet. Bug reports here are unlikely to get the same attention as the current nodes in the pack, and the author has pointed at MaskOpsMEC's preview output as the replacement.
  • Colour choices are just aesthetics. Red at 0.4 opacity over a warm sunset is invisible; flip to edge_highlight or checkerboard when contrast is fighting you. Two seconds, better diagnosis.

If you are new to this: the useful habit is to put this node directly after whatever produced the mask, before the sampler, every single time. The pack's author - a compositor by trade, who announced this pack on r/comfyui in May 2026 - built a whole diagnostic node (Mask Failure Explainer) out of the same frustration this little viewer solves for free.

Category🐺 C2C/🧰 Core/Legacy

Inputs (13)

NameTypeDefaultDescription
imageIMAGE—
maskMASK—
display_modeCOMBOoverlay5 options: overlay, mask_only, side_by_side, checkerboard, edge_highlight
overlay_color_rFLOAT1.000–1—
overlay_color_gFLOAT0.000–1—
overlay_color_bFLOAT0.000–1—
opacityFLOAT0.400–1—
edge_widthINT20–20Edge contour width in pixels
show_bboxBOOLEANfalseDraw bounding box of mask region
bbox_color_rFLOAT0.000–1—
bbox_color_gFLOAT1.000–1—
bbox_color_bFLOAT0.000–1—
bboxoptBBOXExternal bbox to draw (overrides auto-detect)

Outputs (1)

NameTypeDescription
previewIMAGE—