Nodes/ComfyUI Impact Pack/SEGS to MASK (combined)
ComfyUI Node Runs on cloud

SEGS to MASK (combined)

Flatten every detection into one mask

By ltdrdata·Created 3 years ago·Updated 4 months ago· 3,248
SEGS to MASK (combined)
  • segs
  • MASK

Sometimes you don't want the whole SEGS machinery - you just detected some regions and now you want a plain old MASK you can hand to a regular ComfyUI node. SEGS to MASK (combined) is the exit ramp from Impact Pack's world back into vanilla ComfyUI. It takes a SEGS full of separate detections and merges every one of their masks into a single flat MASK.

Think of it as the bridge. You use Impact Pack's detectors because they're good at finding faces, hands, whatever - but then you want to feed that region to a standard KSampler inpaint, a compositing node, or anything that speaks MASK rather than SEGS. This node gets you there in one hop.

How it works

A SEGS holds N detections, each with its own mask sitting in its own crop box. This node paints all of those masks onto one full-frame canvas and ORs them together, so a picture with three detected faces comes out as one mask with three white blobs on it. The "combined" in the name is the operative word - individual detections stop being individual; you get their union as a single mask.

If you need the detections kept separate - one mask per region, as a batch - that's the different SEGSToMaskList node. This one deliberately collapses everything into a single mask, which is what you want when the downstream step treats the whole detected area as one region to inpaint or composite.

The inputs and outputs

Dead simple. One input, segs - the detections you want flattened. One output, MASK - the merged, full-frame mask. There are no knobs, which is exactly right for a format-conversion node; all the tuning (thresholds, dilation, which regions survive) happens on the detector and filter nodes upstream, and by the time you hit this node you've already decided what's in the SEGS.

How to install it

Grab the pack through ComfyUI Manager - search ComfyUI Impact Pack, install, restart. Manual route: cd ComfyUI/custom_nodes && git clone https://github.com/ltdrdata/ComfyUI-Impact-Pack, install requirements into ComfyUI's Python (pip install -r requirements.txt, or ..\..\..\python_embeded\python.exe -m pip install -r requirements.txt on Windows portable), then restart. There's been no auto-install since v7.6, so don't skip the requirements. A small SAM model downloads to ComfyUI/models/sams the first time the pack loads.

Common issues

The mask is all black. Empty SEGS in means empty mask out. If your detector found nothing (threshold too high, or genuinely nothing to detect), there's nothing to flatten. Check the detection stage first.

You wanted separate masks and got one blob. That's what "combined" means - this node unions everything. For per-detection masks, use SEGSToMaskList instead; for one region merged from several, this is the right node.

Sizing surprises. The output mask matches the frame the SEGS were detected on, not any individual crop. If you feed it somewhere expecting a different resolution, resize deliberately rather than assuming it'll match. It's a plumbing node and it does one thing, so if something's off, the cause is almost always upstream in the detection, not here.

CategoryImpactPack/Operation

Inputs (1)

NameTypeDefaultDescription
segsSEGS

Outputs (1)

NameTypeDescription
MASKMASK