Nodes/ComfyUI-gen2/Gen2 Tile Splitter
ComfyUI Node

Gen2 Tile Splitter

Clean auto-grid tiles with context halos, no math homework

By petmycat·Created 7 months ago·Updated 12 days ago· 23
Gen2 Tile Splitter
  • image
  • tile_layout
  • tiles_image_list
tile_size1024
overlap_pct0.25

Tiled generation is how you get huge outputs on a normal GPU: instead of feeding a 4K image to a model that chokes on it, you cut it into pieces, process each piece, and stitch them back together. The catch is seams - if each tile is sampled independently, the tile edges disagree and you get visible grid lines. The fix is overlap: each tile carries a halo of surrounding context so the model knows what's next to it. This node does the splitting for you, automatically, and it's the front end of a whole tiling section in the pack.

How the grid is chosen

You give it an image, a target tile_size, and an overlap_pct, and it works out the rest. The grid is picked automatically: the number of rows and columns minimizes the distance from your target tile size (n = argmin |dimension/n − tile_size|), with no knob to tune. Each tile's "owned" base region exactly partitions the original image - the first rows get floor(H/n), the last row absorbs the remainder - so every pixel belongs to exactly one base region, and there's no double-coverage when you composite later.

The overlap halo is a fixed thickness: overlap_px = round(overlap_pct × base_size) on each side. So a 2048×2048 image with tile_size=1024, overlap_pct=0.25 becomes a 2×2 grid of 1536×1536 tiles, each carrying a 1024×1024 base region wrapped in a 256px halo. Where the expansion runs off the image edge, content is replicate-padded (the edge pixels stretch), which is what you want for the border tiles.

Inputs and outputs

  • image - the IMAGE to split.
  • tile_size - target tile dimension, default 1024 (64–8192).
  • overlap_pct - halo thickness as a fraction of the base, default 0.25 (0–1). 0 gives you a pure partition with no halo, which is rarely what you want for generation but is the right value for exact reconstruction tests.

Two outputs:

  • tile_layout (GEN2_TILE_LAYOUT) - a dict carrying everything downstream needs to reconstruct the partition: original dimensions, rows/cols, overlap in pixels, and per-tile geometry (expanded crop rect, owned base rect, base position within the tile). This is the connective tissue - you feed it to the masks and merger nodes.
  • tiles_image_list - the actual tile images as a list, in row-major order. This is what you send to your sampler, one tile at a time (or batched).

Wiring it into a workflow

The intended pattern: Splitter → (optionally Tile Masks) → sample each tile → Tile Merger, with the tile_layout running in parallel so the merger knows where everything goes. See the Gen2 Tile Merger article for the full picture. This splitter is also a solid replacement for hand-rolled tile cropping in high-res inpaint workflows - the exact-partition guarantee means no overlapping writes and no dropped pixels when you paste back.

Installation

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 the one thing in requirements.txt. If it's missing you'll see [Gen2] Tiling nodes not available: ... in the console and the rest of the pack still loads. Install scipy and restart.

Common issues

  • Tiles smaller than expected on oddly-sized images. The grid minimizes distance to tile_size; a 1537px-wide image won't give you two 1024px tiles, it'll give you the closest partition. If you need exact tile sizes, resize the image to a multiple first.
  • Tiles with weird padding at the border. That's the replicate-pad doing its job on edge tiles. Normal, not a bug.
  • Tiling nodes don't appear in the menu. scipy is missing. pip install scipy in your ComfyUI environment and restart.

There's a smoke test bundled with the pack (tiling/_smoke_test.py) that verifies the partition math round-trips bit-for-bit, so the core geometry is genuinely solid - a nice thing to know when you're building a production upscale pipeline on top of it.

CategoryGen2/Tiling

Inputs (3)

NameTypeDefaultDescription
imageIMAGE
tile_sizeINT102464–8192
overlap_pctFLOAT0.250–1

Outputs (2)

NameTypeDescription
tile_layoutGEN2_TILE_LAYOUT
tiles_image_listIMAGE