ComfyUI Node

Create Seam Mask

Mask the seam so the model can fix what blending can't

By cedarconnor·Created about a year ago·Updated 7 months ago· 2
Create Seam Mask
  • image
  • seam_mask
frac_width0.10
pixel_width0
feather0
roll_x_by_50_percentfalse

The Edge Blender smooths a seam. But a real seam - a person cut in half, a wall that doesn't line up - can't be averaged away; it has to be generated away. Create Seam Mask hands you the mask you need to run that seam through an inpaint pass.

Here's the workflow it exists for, and it's the standard seam-repair pattern in this pack: take your panorama, use the pack's Roll Image (Wrap) node to roll it horizontally by 50% so the seam lands in the middle of the frame where it's easy to work with, create a vertical seam mask with this node (flipping its roll_x_by_50_percent on so the mask follows the roll), inpaint that strip, roll the image back, and finish with the Edge Blender. The result is a seam that isn't just blended - it's actually been re-imagined by the model, which is the only way to fix content that's genuinely broken at the wrap.

How it works

The node builds a vertical strip mask at the center of the image (the longitude where the seam lives), sized to your image, with optional feathering on both sides of the strip. Two ways to set the width:

  • frac_width (default 0.10) - the strip as a fraction of the image width. 0.10 = 10% of the width.
  • pixel_width (default 0) - an exact width in pixels. If it's greater than 0, it overrides frac_width.

feather (default 0) softens the mask edges by that many pixels on both sides, which is the difference between a hard mask boundary (visible inpaint edge) and a soft one (blends in). roll_x_by_50_percent (off by default) shifts the mask horizontally by half the image width - turn it on if you rolled the image first, so the mask lands on the seam you actually moved.

The mask convention is ComfyUI standard: where the mask is 1, the model generates; where it's 0, it keeps the original. So this node's mask = "regenerate this strip."

Inputs and outputs

  • image (required) - reference image (B,H,W,C) used only to size the mask; its pixels don't matter.
  • frac_width / pixel_width / feather / roll_x_by_50_percent - as above.

Output is a single seam_mask (a MASK tensor), sized to the input image, ready for the standard inpainting encode.

Installing it

Part of the LatLong pack - Manager search "LatLong", or:

cd ComfyUI/custom_nodes
git clone https://github.com/cedarconnor/comfyui-LatLong
cd comfyui-LatLong
pip install -r requirements.txt

Restart ComfyUI. It lives under LatLong/Mask. Deps: numpy, opencv-python, scipy, torch, Pillow; no models.

Gotchas

Feather is your friend and your enemy. Too little and the inpaint leaves a hard edge you can still see; too much and the model starts rewriting content well past the seam, which can shift the whole scene. 10–30px is a sane start depending on resolution. And remember the mask is sized from whatever image you feed it - feed it the rolled image (if you're doing the roll workflow) or the mask won't line up. Also note this masks a strip at the vertical center; the poles are a separate problem with a separate tool (Create Pole Mask).

CategoryLatLong/Mask

Inputs (5)

NameTypeDefaultDescription
imageIMAGEReference image (B,H,W,C) used to size the mask.
frac_widthoptFLOAT0.100–1Fraction of image width for the seam strip (ignored if pixel_width > 0).
pixel_widthoptINT00–8192Explicit seam width in pixels (overrides frac_width if > 0).
featheroptINT00–2048Feather width in pixels on both sides of the seam.
roll_x_by_50_percentoptBOOLEANfalseShift the mask horizontally by 50% (useful if you rolled the image by 180°).

Outputs (1)

NameTypeDescription
seam_maskMASK