Nodes/SimpleTiles/TileCalc (Legacy)
ComfyUI Node

TileCalc (Legacy)

The only math SimpleTiles still makes you do

By kinfolk0117·Created 3 years ago·Updated 2 years ago· 60
TileCalc (Legacy)
    • final_height
    • final_width
    tile_height64
    tile_width64
    overlap64
    tile_width_n3
    tile_height_n3

    TileCalc is a tiny arithmetic helper that answers one question: if I tile an image into a grid, what size does the final stitched image come out as? In the legacy SimpleTiles world, that answer wasn't automatic - TileMerge (Legacy) wants explicit final_width and final_height numbers, and you had to compute them yourself. This node does the computing.

    If you're building a fresh workflow today, you probably don't need it. The Dynamic pair (DynamicTileSplit → DynamicTileMerge) carries the size around in a TILE_CALC object and never asks you for a number. TileCalc is for the legacy path: the "I already know my tile sizes and grid, just tell me the output dimensions" case, or for maintaining old workflows that predate the dynamic nodes.

    How it works

    It's a straightforward formula. Given your tile size, the number of tiles along each axis, and the overlap, it subtracts the overlap each time two tiles meet:

    • final_width = tile_width × tile_width_n − overlap_x × (tile_width_n − 1)
    • final_height = tile_height × tile_height_n − overlap_y × (tile_height_n − 1)

    One quirk inherited from the legacy nodes: overlap_x is the overlap you typed, but overlap_y is scaled by the tile aspect ratio (overlap × tile_height / tile_width). That's the same convention TileSplit (Legacy) and TileMerge (Legacy) use, so the numbers line up.

    The inputs

    • tile_width / tile_height: your tile size - set them to match what you feed TileSplit.
    • overlap: must match the split/merge overlap too.
    • tile_width_n / tile_height_n: the number of tiles along each axis (1–9). The legacy nodes are built for up to a 9×9 grid, and these two numbers define that grid.

    Outputs

    Two plain INTs: final_height and final_width. Wire them into TileMerge (Legacy)'s final_height / final_width inputs, and into an ImageScale if you need to resize your source to match before splitting. That's the whole loop: calculate → scale source to final size → split → sample → merge at the same final size.

    Installing it

    Comes with the SimpleTiles pack - ComfyUI Manager → search SimpleTiles, or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/kinfolk0117/ComfyUI_SimpleTiles
    

    Restart ComfyUI. No dependencies beyond PyTorch, no model downloads. It shows up under utils in the node menu.

    Common issues

    • Mismatched overlap between Calc, Split, and Merge. The formula only produces a correct final size if the overlap you type matches what the splitter and merger actually use. Change one, change all three.
    • The defaults are placeholders. Everything defaults to 64 (tile and overlap) and 3×3 tiles, which gives you a 192×192 output - nobody runs that. Set them per image; they're clearly leftovers from the LCM-era square-resolution testing the author did.
    • Using it with the Dynamic nodes. Don't. DynamicTileSplit/DynamicTileMerge already do this internally, and mixing legacy TileCalc into a dynamic workflow just adds a place for numbers to drift out of sync.
    Categoryutils

    Inputs (5)

    NameTypeDefaultDescription
    tile_heightINT6464–4096
    tile_widthINT6464–4096
    overlapINT640–4096
    tile_width_nINT31–9
    tile_height_nINT31–9

    Outputs (2)

    NameTypeDescription
    final_heightINT
    final_widthINT