🐳遮罩区域扩展
Grow a mask asymmetrically — 5px left, 40px down — with a soft edge
- mask
- MASK
The built-in mask grow tools in ComfyUI expand uniformly - a fixed number of pixels in every direction. Real-world masks rarely want that. A face mask needs to grow a little into the forehead but a lot down the neck. A subject mask needs extra canvas at the bottom for a reflection. 🐳遮罩区域扩展 (Mask Region Expand) is the node for that: it expands a mask in four independent directions - left, top, right, bottom each get their own pixel count - with optional edge smoothing and a distance-based gradient falloff.
The asymmetric control is the whole reason it exists, but the gradient toggle is the sleeper feature. With 使用渐变 (use gradient) on, the expanded band fades out over the expansion distance instead of hard-cutting, which makes inpainting and compositing look dramatically better than a blunt enlargement.
How it works
You pick which region to expand - 黑色区域 (the black/background region) or 白色区域 (the white selection) - and the node inverts the mask internally if needed so the target region is what grows. Then it expands by the per-direction pixel amounts (左/上/右/下, each 0–1000). Two quality controls follow:
边缘平滑(edge smoothing, 0–50) - softens the new boundary.使用渐变(use gradient, 是/否) - adds a distance-based falloff so the expansion fades to nothing at its outer edge instead of stepping.
Inputs and output
mask- the MASK.左(left),上(top),右(right),下(bottom) - expansion in pixels per direction, all 0–1000.扩展区域(expand region) - 黑色区域 or 白色区域, default 黑色区域.边缘平滑(0–50) and使用渐变(否/是).
Output: the expanded MASK.
Three practical notes. First, all-zero expansion returns the input untouched - there's no "whole-canvas" surprise. Second, if your expanded mask doesn't seem to grow, check 扩展区域: defaulting to 黑色区域 means it grows the background, which for a small white region on a big black canvas looks like the mask is staying put while the border shrinks. Flip it to 白色区域 to grow the selection itself. Third, like the pack's other single-mask tools, it works on one mask at a time (batch frames get normalized to the first), and the distance math uses scipy, so that dependency needs to be installed.
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, numpy, and scipy cover it - no models. Pack footnote: the README documents a console-spam conflict with comfyui_HiDream-Sampler if you run both.
Inputs (8)
| Name | Type | Default | Description |
|---|---|---|---|
| mask | MASK | — | |
| 左 | INT | 00–1000 | — |
| 上 | INT | 00–1000 | — |
| 右 | INT | 00–1000 | — |
| 下 | INT | 00–1000 | — |
| 扩展区域 | COMBO | 黑色区域 | 2 options: 黑色区域, 白色区域 |
| 边缘平滑 | INT | 00–50 | — |
| 使用渐变 | COMBO | 否 | 2 options: 否, 是 |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| MASK | MASK | — |