Nodes/SaltAI-Open-Resources/Add Mask Regions
ComfyUI Node

Add Mask Regions

Combine two masks into one

By get-salt-AI·Created 2 years ago·Updated 2 years ago· 84
Add Mask Regions
  • masks_a
  • masks_b
  • MASKS

Sometimes one mask isn't enough - you've segmented a face separately from a pair of hands, or two independent regions each need their own pass to generate, and you want them treated as one combined selection for whatever comes next. SaltMaskAdd is the node for merging them: two masks in, one combined mask out.

What it does

Two required inputs, masks_a and masks_b, and a single MASKS output. It's a simple additive combination - wherever either input mask has activity, the combined result includes it, functioning like a union of the two selections. Because it's addition rather than a strict max/OR blend, two masks that overlap in the same bright region can push the combined value higher than either input alone - usually harmless since mask values clamp at their upper bound, but worth being aware of if you're doing anything precise with partial (non-binary) mask values in the overlap zone.

Where you'd use it

The natural case is combining independently-generated regions into one target: mask a face with one pass and hands with another (say, two separate SaltCLIPSegMasking calls with different text prompts), then add them together before feeding a single combined mask into an inpaint or detail pass, instead of running two separate passes. It's also useful for building up a composite selection piece by piece - start with one region, add another, add a third - rather than trying to get one segmentation pass to capture everything in a single go.

Installing it

ComfyUI Manager: search SaltAI-Open-Resources. Manual install:

cd ComfyUI/custom_nodes
git clone https://github.com/get-salt-AI/SaltAI

Restart ComfyUI. No dependencies beyond the pack itself.

Common issues

If your masks are the graded/soft kind rather than clean binary shapes, watch the overlap zones - additive combination can push already-bright overlapping regions toward full white faster than you'd expect from a pure union, which occasionally shows up as a harder edge exactly where the two input masks intersected. If that matters for your use case, thresholding the result afterward with SaltMaskThresholdRegion normalizes it back into a cleaner shape. And obviously, make sure both input masks are actually meant to apply to the same image/batch in the same order - adding two masks that don't correspond to the same underlying image just produces a combined mask that means nothing.

CategorySALT/Masking/Filter

Inputs (2)

NameTypeDefaultDescription
masks_aMASK
masks_bMASK

Outputs (1)

NameTypeDescription
MASKSMASK