Nodes/wlsh_nodes/Generate Border Mask (WLSH)
ComfyUI Node

Generate Border Mask (WLSH)

The second-pass fix for outpainting seams

By wallish77·Created 3 years ago·Updated 2 years ago· 144
Generate Border Mask (WLSH)
  • image
  • IMAGE
direction
pixels128
overlap64

This one only makes sense once you've hit the problem it solves: you outpaint an image, and the seam where old pixels meet new ones looks pasted on. That's not a rare failure - it's the default failure of outpainting, and the community's whole bag of fixes for it boils down to "run a second pass over just the seam with a blurred mask." This node exists to generate exactly that mask, automatically, instead of you painting a stripe by hand.

What it actually does. You give it an already-outpainted image and tell it which direction the new content was added in (left/right/up/down - same four options as this pack's own Outpaint to Image node, which is the node you'd typically run right before this one). It draws a stripe that straddles the boundary between old and new pixels - pixels controls how far out from the edge the stripe extends, overlap controls how far it reaches back into the original image, and the whole thing gets soft, blurred edges rather than a hard line. Feed that stripe as your mask into a second denoise pass and you're only re-rendering the seam, not the whole outpainted region, which means you keep the composition from your first pass and just smooth the transition.

One thing that trips people up: the output is typed IMAGE, not MASK. That's deliberate, not an oversight - the README is explicit that you're meant to run it through a Convert Image to Mask node afterward, using the green channel. The border-mask data is encoded as a grayscale-in-color image rather than emitted as a native mask, so don't wire this straight into a KSampler's mask input expecting it to work; drop the conversion node in between first.

Inputs, and what a beginner sets: image (your outpainted result), direction (must match the side you extended on), pixels (default 128, how wide the fix zone is), overlap (default 64, how far it bites into the original). Bigger overlap and pixels values give you a more forgiving blend but eat more of your original image in the redo; the defaults are a reasonable starting point and you'll rarely need to push past them unless your outpaint extended a very large area.

Installing it

Via ComfyUI Manager: search "wlsh_nodes" (or "WLSH Nodes") and install. Manually: cd ComfyUI/custom_nodes && git clone https://github.com/wallish77/wlsh_nodes, then restart ComfyUI. No models or extra dependencies to worry about.

Common issues

This is squarely the community-standard advice for outpainting seams, not a WLSH-specific trick: generous overlap, adequate blur, and - the part people skip - recognizing that one pass rarely nails it. If the seam is still visible after your second pass, it's usually because the mask's pixels/overlap were too tight for how much content actually needed to change, or because the second pass's denoising strength was too low to actually repaint the stripe convincingly. And remember the channel gotcha above: a mask that looks blank or inverted almost always means you pulled the wrong channel out of the Convert Image to Mask node, not that this node produced a bad mask.

CategoryWLSH Nodes/inpainting

Inputs (4)

NameTypeDefaultDescription
imageIMAGE
directionCOMBO4 options: left, right, up, down
pixelsINT12832–512
overlapINT6416–256

Outputs (1)

NameTypeDescription
IMAGEIMAGE