Nodes/comfy_Pond_Nodes/🐳遮罩对齐扩展(V2)
ComfyUI Node

🐳遮罩对齐扩展(V2)

Align five masks to one canvas — and get a merged mask for free

By Pondowner857·Created about a year ago·Updated 21 days ago· 45
🐳遮罩对齐扩展(V2)
  • 基准遮罩
  • 遮罩2
  • 遮罩3
  • 遮罩4
  • 遮罩5
  • 基准遮罩
  • 对齐遮罩2
  • 对齐遮罩3
  • 对齐遮罩4
  • 合并遮罩
对齐方式居中对齐
X轴偏移0
Y轴偏移0

This is the "V2" of 🐳 Pond Nodes' MaskSizeAlign, and the upgrade is real: instead of aligning a single mask to a base, it aligns up to four masks to one base and hands you a merged combination mask at the end. If you've ever tried to run regional inpainting on a face, both hands, and a shirt - each masked by a different detector at a different resolution - you know exactly why that merged output exists.

It's the same mechanism as the basic node: find the non-zero content bounds of each mask, pad it onto a canvas the size of the base with black (empty) borders, no stretching of the actual shape. The V2 adds two things the basic one lacks: pixel offsets and the merge.

The inputs that matter

  • 基准遮罩 (base mask) - the reference canvas. Its size is law.
  • 遮罩2 through 遮罩5 - up to four masks to align. Only mask 2 is required; 3, 4, and 5 are optional. Give it one mask and it behaves like the basic node.
  • 对齐方式 - the same 9 positions: center, left/right/top/bottom, and the four corners.
  • X轴偏移 / Y轴偏移 (X/Y offset) - nudge an aligned mask in pixels, −1024 to 1024. This is the knob the basic node is missing. Detector masks are almost never perfectly registered, and a few pixels of nudge often makes the difference between a clean composite and a visible seam.

The outputs that matter

Five outputs: 基准遮罩 (base passthrough), 对齐遮罩2/3/4 (each aligned mask), and the one you'll actually reach for - 合并遮罩 (merged mask), the union of everything. That merged mask is what you feed into an inpainting node, a mask combine, or a regional conditioning setup in one wire instead of four.

Realistic workflow: you've got a face mask from one detector and hand masks from another, all different sizes. Align them all to a full-canvas base with the same alignment mode, nudge with offsets until they sit right, then take 合并遮罩 straight into your Set Latent Noise Mask or mask-blend. It replaces a small pile of Resize, Paste, and Mask Combine nodes.

Installing it

The whole pack installs the same way - Manager search 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

Then restart. This node itself only needs the core stack (torch, numpy, Pillow) - the heavy stuff in requirements.txt (ultralytics, realesrgan, mediapipe) is for other nodes in the pack, so if you're only here for masks you can skip the full pip install and let ComfyUI run it on what it already has. Note the README's warning: a conflict with comfyui_HiDream-Sampler can cause the console to endlessly scroll; check for that plugin if you see it.

The gotcha

Same as the basic version, with extra room to trip: alignment pads with black, it doesn't stretch content, so your merge only covers where each mask was. And when you start stacking offsets, remember they apply per-mask globally - you're nudging everything, not one region. Check the merged mask in a preview node before you commit, because a merged mask that's a few pixels off on a face pass is a soft-face pass.

Category🐳Pond/mask

Inputs (8)

NameTypeDefaultDescription
基准遮罩MASK
遮罩2MASK
对齐方式COMBO居中对齐9 options: 居中对齐, 左对齐, 右对齐, 上对齐, 下对齐, 左上对齐, +3
遮罩3optMASK
遮罩4optMASK
遮罩5optMASK
X轴偏移optINT0-1024–1024
Y轴偏移optINT0-1024–1024

Outputs (5)

NameTypeDescription
基准遮罩MASK
对齐遮罩2MASK
对齐遮罩3MASK
对齐遮罩4MASK
合并遮罩MASK