Nodes/comfy_Pond_Nodes/🐳多遮罩运算
ComfyUI Node

🐳多遮罩运算

Intersect A and B, then subtract C

By Pondowner857·Created about a year ago·Updated 21 days ago· 45
🐳多遮罩运算
  • 基准遮罩
  • 遮罩2
  • 遮罩3
  • 遮罩4
  • 最终结果
  • 运算序列
运算1交集
运算2交集
运算3交集
对齐方式居中对齐
阈值0.50

Single boolean operations are fine, but real region-building is a sequence. "Take the body mask, intersect it with the clothing mask, then subtract the face mask." The two-mask boolean node makes you chain nodes for that; 🐳多遮罩运算 (Mask Multi Boolean) does it inside one node, with up to four masks and a per-step operation for each fold. It's the boolean answer to the pack's multi-merge node - where that one unions things together, this one lets you chain intersect/subtract/XOR logic.

The mechanism is a left-fold: start with the base mask, combine with mask 2 using operation 1, take that result and combine with mask 3 using operation 2, and so on. Each step picks its own operation, so you get genuinely expressive region math in one node. Like the pack's other mask nodes it also aligns masks to the base first (five alignment modes) and applies a threshold for what counts as "selected."

Inputs and outputs

  • 基准遮罩 (base mask) - the anchor (tooltip: 作为基准的遮罩).
  • 遮罩2 (mask 2) - required (tooltip: 第二个遮罩).
  • 运算1 (operation 1) - how base and mask 2 combine: 交集 (intersection), 并集 (union), 差集 (difference), 异或 (XOR). Default 交集.
  • Optional 遮罩3 + 运算2, and 遮罩4 + 运算3 - the next folds, same four operations each.
  • Optional 对齐方式 (5 modes, default 居中) and 阈值 (default 0.5).

Outputs:

  • 最终结果 (final result, MASK) - the folded mask.
  • 运算序列 (operation sequence, STRING) - a text summary of what was chained. Handy for keeping track of a six-way boolean chain when you come back to the workflow next week.

One honest gotcha: 差集 here is A − B (current result minus the next mask), and since it's a fold, order genuinely matters - "A − B − C" is not the same as "A − C − B." If your result comes out looking inverted, check whether you meant to subtract at all or reach for the pack's single MaskAlignBooleanNode for a two-mask job with the full seven-op menu including NOT A / NOT B. This node trades that completeness for chaining.

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. Torch and numpy cover it - no models. Pack footnote: the README warns of a console-spam conflict with comfyui_HiDream-Sampler if you have both installed.

Category🐳Pond/mask

Inputs (9)

NameTypeDefaultDescription
基准遮罩MASK作为基准的遮罩
遮罩2MASK第二个遮罩
运算1COMBO交集基准遮罩与遮罩2的运算
遮罩3optMASK第三个遮罩
运算2optCOMBO交集前面结果与遮罩3的运算
遮罩4optMASK第四个遮罩
运算3optCOMBO交集前面结果与遮罩4的运算
对齐方式optCOMBO居中对齐5 options: 居中对齐, 左对齐, 右对齐, 上对齐, 下对齐
阈值optFLOAT0.500–1

Outputs (2)

NameTypeDescription
最终结果MASK
运算序列STRING