Nodes/ComfyUi-MpiNodes/Mpi Grid Dimensions
ComfyUI Node

Mpi Grid Dimensions

Tile sizes that actually line up for tiled upscaling

By MadPonyInteractive·Created 11 months ago·Updated 5 days ago· 3
Mpi Grid Dimensions
  • image
  • tile_width
  • tile_height
  • horizontal_split
  • vertical_split
horizontal_split1
vertical_split1
upscale_factor1.0
autofalse

Tiled upscaling - splitting a big image into tiles, running diffusion on each, stitching them back - is the standard way to get huge images out of limited VRAM. And the single most common way to screw it up is to ask for tiles that don't divide the upscaled image evenly. Result: repeated tiles, seams, and half-tiles at the edges. MpiGridDimensions is the pack's fix: give it an image and a split count, and it computes tile dimensions that land exactly on the grid, so every tile is a clean, distinct region. It was built specifically to stop "repeated tiles" when fed to UltimateSDUpscale.

How it works

Feed it an image plus your horizontal_split and vertical_split counts and an upscale_factor. It works backwards: it takes the upscaled dimensions (width × upscale_factor, height × upscale_factor), divides by the split count, and rounds the tile size up to a multiple of the upscale factor. That rounding-up is the whole trick - it guarantees each tile is an integer multiple of the upscale factor, so the full tiled grid reconstructs the image without fractional leftover tiles.

The auto toggle removes the guesswork: it picks the split counts for you. It caps the total tile count by output size (4 tiles for upscales under 1024px on the long side, 6 under 2048, 9 above), rejects any tile side over 768px, and scores the remaining layouts by how close tiles are to square. Best score wins. For "I just want it to work," auto on is the answer.

Outputs: tile_width, tile_height, plus the horizontal_split / vertical_split actually used (which matter when auto overrode your manual counts). Wire the tile size into your tile-upscale step and the splits into your grid.

The inputs that matter

  • horizontal_split / vertical_split - how many tiles across/down. Ignored when auto is on.
  • upscale_factor - the target upscale (e.g. 2 for 2×), which the tile math has to respect.
  • auto - let the node pick the layout.

Where people get burned

If you hand-typed tile sizes before, the mental model to unlearn is "tile size is the target." Here the tile size is a derived value - you set the split count and the node tells you what size tiles that produces. And when auto is on, don't expect it to honour the split widgets; it overwrites them. If you need a specific number of tiles (say exactly 2×2), leave auto off and set the splits manually. Note the max tile side in auto mode is 768px - that's a VRAM-friendly ceiling, not a quality cap.

Install

From the MadPonyInteractive/ComfyUi-MpiNodes pack. ComfyUI Manager → search ComfyUi-MpiNodes (publisher mad-pony-interactive), install, restart. Or:

cd ComfyUI/custom_nodes
git clone https://github.com/MadPonyInteractive/ComfyUi-MpiNodes

then restart. No dependencies, no models to download - pure dimension math. The pack is AGPL-3.0 (≤ 1.2.6 MIT) and is the node library behind the author's Cubric Vision app.

The verdict

If you only ever upscale to 2× with a fixed tile grid, you can compute this once in your head and hard-code it. But the moment your pipeline changes resolution - batch sizes, aspect ratios, variable sources - recomputing legal tile sizes by hand is exactly the kind of arithmetic people get wrong at 1am. auto makes it one node and done. It's the quiet fix that turns "why is this tile repeated?" into a non-question.

CategoryMpiNodes/ImgOps

Inputs (5)

NameTypeDefaultDescription
imageIMAGE
horizontal_splitINT11–64
vertical_splitINT11–64
upscale_factorFLOAT1.00.1–10
autoBOOLEANfalse

Outputs (4)

NameTypeDescription
tile_widthINT
tile_heightINT
horizontal_splitINT
vertical_splitINT