Nodes/comfy_Pond_Nodes/🐳遮罩合并
ComfyUI Node

🐳遮罩合并

The no-fuss two-mask merge that aligns first

By Pondowner857·Created about a year ago·Updated 21 days ago· 45
🐳遮罩合并
  • 基准遮罩
  • 遮罩2
  • 合并遮罩
对齐方式居中对齐
合并模式相加模式

Mask merging in ComfyUI usually assumes both masks already line up. They almost never do. 🐳遮罩合并 (Mask Align Merge Simple) is the small, honest version of the fix: it takes a base mask and one more mask, aligns the second to the first, and combines them with a simple blend mode. Two masks in, one merged mask out. No options you have to think about, which is exactly its charm.

The everyday use case: you have a subject mask and a separately-detected region mask - say a body mask and a face mask from different detectors - and you want one combined mask so a single inpaint pass covers both. Or you're merging a mask with an edge-fattened copy of itself to get a slightly larger region. This node is the "just combine them" button for exactly two inputs.

How it works

It finds the white-region bounding box of each mask and shifts the second to align with the base (that's the 对齐方式, with five modes: center, left, right, top, bottom). Then 合并模式 picks how the two are combined pixel-by-pixel:

  • 相加模式 (add) - values add, capped at 1. Overlapping areas stay fully white.
  • 最大值模式 (max) - the brighter of the two at each pixel. Same look as add for binary masks.
  • 最小值模式 (min) - the dimmer of the two, which gives you the intersection-ish overlap. Handy when you want only what both masks agree on.

Inputs and output

  • 基准遮罩 (base mask) - the anchor. Everything aligns to this.
  • 遮罩2 (mask 2) - the mask that gets moved into place.
  • 对齐方式 - 5 alignment modes, default 居中 (center).
  • 合并模式 - add / max / min, default 相加 (add).

Output: a single 合并遮罩 (merged mask, MASK) ready to feed an inpaint, a detailer, or a compositor.

The one thing to know: it's the simple sibling. It does not expose pixel offsets, and it only handles two masks. If you need to merge more than two masks - up to eight, with multiply and screen blend modes and X/Y offsets - the pack's MaskMultiAlignMergeNode (🐳多遮罩合并) is the bigger tool. If you need boolean ops (intersection, difference, XOR) on aligned masks, that's MaskAlignBooleanNode. This node is deliberately the quick one.

Install

Standard Pond Nodes install:

ComfyUI Manager → search "Pond Nodes" (comfy_Pond_Nodes)

or:

cd ComfyUI/custom_nodes
git clone https://github.com/Pondowner857/comfy_Pond_Nodes
cd comfy_Pond_Nodes
pip install -r requirements.txt

Restart after. It runs on torch and numpy; no models, no downloads. Pack footnote: the README warns of a console-spam conflict with comfyui_HiDream-Sampler if both are installed.

Category🐳Pond/mask

Inputs (4)

NameTypeDefaultDescription
基准遮罩MASK
遮罩2MASK
对齐方式COMBO居中对齐5 options: 居中对齐, 左对齐, 右对齐, 上对齐, 下对齐
合并模式COMBO相加模式3 options: 相加模式, 最大值模式, 最小值模式

Outputs (1)

NameTypeDescription
合并遮罩MASK