ComfyUI Node

DAM Mask Visualizer

Draw contour outlines around whatever you're about to edit

By Irsalistic·Created about a year ago·Updated about a year ago· 6
DAM Mask Visualizer
  • image
  • mask
  • IMAGE
contour_thickness6
contour_colorwhite
threshold0.010

Masks are invisible until something renders them, and "trust me, it's masked" is a great way to find out your SAM output actually covered the background. DAM Mask Visualizer (class DAMVisualizeNode) is the cheap, honest sibling in the ComfyUI DAM Object Extractor pack: it takes your image and your mask and draws contour outlines around the masked region, so you can see what you're about to feed into an inpainting, detailer, or - naturally - the pack's own DAM Object Name Extractor.

What it actually does

No AI here. This node is pure OpenCV. It takes the mask, thresholds it into binary white pixels, runs cv2.findContours to trace the edges, and draws them onto a copy of your image at the thickness and color you pick. That's the whole mechanism, which is a feature: it's instant, it's deterministic, and it can't hallucinate a boundary the mask doesn't have.

The same thresholding logic the pack uses for the model node applies here, so the two nodes agree on what counts as "masked." That consistency is the real reason to use this pair together - what you see outlined is exactly the region the name extractor will describe.

Inputs and output

  • image and mask - your existing tensors, straight from a Load Image, a SAM node, or whatever made the mask.
  • contour_color - a small fixed palette: white, red, green, blue, yellow. Red's the usual pick for visibility against most photos.
  • contour_thickness - 1 to 20 pixels; the default 6 reads clearly without burying the image.
  • threshold - same meaning as the name extractor's: how much brightness counts as "in the mask." Default 0.01, which suits the faint 0–1 masks ComfyUI produces.

The output is a single IMAGE with the contours baked in - wire it to a preview node, a Save Image, or the video track of your choice. It returns in the standard ComfyUI [B, H, W, C] float format, so it slots into the same graph without conversion.

Install and gotchas

It ships in the ComfyUI DAM Object Extractor pack, so installation is the same as its sibling: search "ComfyUI DAM Object Extractor" in ComfyUI Manager, or

cd ComfyUI/custom_nodes
git clone https://github.com/Irsalistic/comfyui-dam-object-extractor

then restart ComfyUI. The visualizer is lightweight, but the pack's requirements are not - opencv-python, torch, transformers, timm and friends come along for the ride, and the whole pack will happily pull a transformers dev build to satisfy the name extractor's pin. Note the visualizer imports cv2 lazily inside the function, so if opencv somehow isn't installed this node silently returns your original image instead of crashing - a real "why is nothing happening?" moment if you ever hit it.

The honest review

This is a utility node, and it's fine at being a utility node. If you already have Impact Pack installed (which any serious mask/detailer user does), you probably already have a mask-preview path. What this one adds is zero-config setup, the same threshold as the name extractor, and a color choice. Its niche is debugging and communicating: check your mask covers the object before you waste a 6GB-model call, or export a "here's what got segmented" preview for a dataset or a friend. For that job it's simple, fast, and doesn't get in your way - which is more than most of the one-node packs you'll find can say.

Categoryimage/visualization

Inputs (5)

NameTypeDefaultDescription
imageIMAGE
maskMASK
contour_thicknessINT61–20
contour_colorCOMBOwhite5 options: white, red, green, blue, yellow
thresholdFLOAT0.0100.001–0.999

Outputs (1)

NameTypeDescription
IMAGEIMAGE