Expand and Blur the Mask
Grow your selection before you inpaint
- mask
- IMAGE
Two knobs, one job: this node takes a mask, pushes its edges outward by however many pixels you tell it, then softens that new edge with a blur. That's the entire node. It's the kind of small, unglamorous utility that makes the difference between an inpaint that blends and one with a visible ring around it.
Why you'd want this
Masks are almost always a little too tight. Whether you painted one by hand, generated one from a segmentation model, or derived one from an object-detection bounding box, the edge tends to sit right at the object's boundary - which means the model regenerates exactly what you selected and leaves a thin, untouched rim of the original pixels right around it. That rim is where seams come from. Growing the mask outward a bit before you inpaint gives the model enough room to actually blend the new content into its surroundings instead of stopping dead at a hard line. Blurring the mask edge on top of that does the second half of the job: it feathers the transition so the composite doesn't look like it was cut out with scissors. The community's own rule of thumb for mask feathering is 4 to 12 pixels - too little and you get hard seams, too much and the change bleeds into stuff you didn't want touched. expansion and blur here map onto exactly that.
The inputs that matter, and one landmine
mask- the mask to grow. Here's the catch: despite the name, this socket's type isIMAGE, notMASK. If you're feeding it from a mask editor or a node that outputs an actualMASKtype, you'll need a conversion node (Mask to Image / Image to Mask) somewhere in the chain, or ComfyUI will refuse the connection.expansion(0–256, default 0) - how many pixels to grow the mask outward. Start small; 8–20px covers most "the mask was a hair too tight" situations.blur(0–64, default 0) - how much to soften the new edge afterward.
The single output is an IMAGE - your expanded, blurred mask, ready to feed into whatever needs a mask next: this same pack's ContentMaskLatent, a standard VAE-encode-for-inpainting setup, or an ImageCompositeMasked at the end of your pipeline.
Installing it
Grab it through ComfyUI Manager - search "Comfy-Photoshop-SD" and install - or clone it by hand:
cd ComfyUI/custom_nodes
git clone https://github.com/AbdullahAlfaraj/Comfy-Photoshop-SD
Restart ComfyUI afterward either way.
Where people get burned
The IMAGE-vs-MASK type mismatch above is the one that trips people up first - ComfyUI's type checker will just refuse to connect the wire, and the fix is a one-node conversion, not a bug in your workflow. Past that, it's a matter of taste more than troubleshooting: crank blur too high and you'll bleed your edit into background you meant to leave alone, and expansion too high on a small object can end up growing the mask past neighboring content you didn't intend to touch. If your inpaint result looks smeary at the edges rather than sharp-but-blended, dial blur back down before you touch anything else.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| mask | IMAGE | — | |
| expansion | INT | 00–256 | — |
| blur | INT | 00–64 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| IMAGE | IMAGE | — |