Gen2 Seam Fix
The second pass that kills ghosted tile seams
- original_image
- merged_image
- tile_layout
- seam_layout
- seam_tiles
- seam_tiles_masks
Here's the honest limit of tiled generation: even with a good merger, tiles sampled independently disagree at their seams. The same image-space pixel can look different inside tile A's halo and tile B's base, so the blend hides the line but leaves a ghost or a texture mismatch where the two regenerations meet. The Gen2 Tile Merger can't fix that - the damage is baked into the tiles. This node is the second pass: it carves out exactly the seam strips, lets you regenerate just those strips with the surrounding content as context, and hands the result to a matching merger. Targeted, cheap, and it's how you get a genuinely seamless output.
How it works
You feed it the original_image, the first-pass merged_image, and the tile_layout from the splitter. It finds every vertical and horizontal seam in the grid and carves the union of seam neighborhoods into tiles:
- One intersection tile per (vertical × horizontal) crossing - a square centered on the crossing.
- One arm tile per seam segment between intersections (or between an edge and the first/last intersection) - a long rectangle running along the seam axis.
All of them tile the cross-shaped seam neighborhood with no overlap, so the seam merger doesn't have to renormalize across overlapping tiles. The author's worked example: a 2×2 grid at 2048×2048 with seam_strip_width=128 gives one 640×640 intersection plus four arms, five tiles total.
Each seam tile's image content is the merged image cropped at the tile rect, with the strip region overwritten by the original image's content. That gives the sampler a clean inpaint init at the strip and the regenerated base content as conditioning context - so the second pass only has to smooth the seam, not reinvent the tile.
Inputs and outputs
original_image- the pre-tile source image (used as the inpaint init for the strips).merged_image- the first-pass result from the Tile Merger.tile_layout- theGEN2_TILE_LAYOUTfrom the splitter, so it knows where the seams are.seam_strip_width- how wide the regenerated strip is, default 128 (8–1024).mask_blend_pixels- Gaussian feathering on the strip masks, default 32.
Outputs: seam_layout (GEN2_SEAM_LAYOUT - the geometry for the merger), seam_tiles (list of tile images), and seam_tiles_masks (list of strip masks, feathered by mask_blend_pixels). Wire all three downstream: sample the tiles, then feed them to Gen2 Seam Merger.
The second pass usually runs at low denoise - the goal is blending, not regeneration, so you want the strip content to stay close to what's already there.
Installation
Part of petmycat/ComfyUI-gen2. Install via ComfyUI Manager (search "ComfyUI-gen2"), or:
cd ComfyUI/custom_nodes
git clone https://github.com/petmycat/ComfyUI-gen2
cd ComfyUI-gen2
pip install -r requirements.txt
The tiling section needs scipy (it's in requirements.txt). Missing it → tiling nodes don't register; pip install scipy and restart.
Common issues
- Second pass doesn't change the seam. Check your denoise strength - if it's too low the strip comes back identical to the merged content, seams and all. The strips are meant to be re-denoised.
- Seam tiles overlap or gaps appear in the final image. The layout math guarantees a no-overlap tiling of the seam neighborhood, but only if
tile_layoutactually matches the split you ran. Reuse the same layout object. seam_strip_widthtoo small. The strip needs to cover the region where the two tiles' errors overlap, which is around the halo. Too thin a strip and the seam sneaks back in.
Used with the Seam Merger, this is the difference between "good enough" tiled upscales and output you can't find the grid lines in without squinting. It's a real workflow step, not a gimmick - the README's diagram of the two-pass pipeline is worth a look before you wire it up.
Inputs (5)
| Name | Type | Default | Description |
|---|---|---|---|
| original_image | IMAGE | — | |
| merged_image | IMAGE | — | |
| tile_layout | GEN2_TILE_LAYOUT | — | |
| seam_strip_width | INT | 1288–1024 | — |
| mask_blend_pixels | INT | 320–256 | — |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| seam_layout | GEN2_SEAM_LAYOUT | — |
| seam_tiles | IMAGE | — |
| seam_tiles_masks | MASK | — |