Nodes/comfyui_bmad_nodes/UnGridify (image)
ComfyUI Node Runs on cloud

UnGridify (image)

UnGridify (image)

By bmad4ever·Created 3 years ago·Updated 9 months ago· 70
UnGridify (image)
  • image
  • IMAGE
columns3
rows3

UnGridify (image) is the reverse of the pack's Repeat Into Grid (image): it takes a single grid image and slices it into columns × rows tiles, handing you back a list of individual images. If the grid node is how you make a contact sheet, this is how you break it apart again - which makes it the workhorse of "tile, process, reassemble" workflows.

How it works

Mechanically it's plain tensor slicing. The image is divided into equal tiles along the height and width axes - tile_height = height // rows, tile_width = width // columns - and each tile is returned in reading order (top-left to bottom-right, row by row). The output is an IMAGE list, not a batch, so it plugs straight into list-consuming nodes.

Inputs: image, columns, rows (both default 3, max 8). Output: a list of IMAGEs.

Where you'd use it

The obvious case is reversing a grid you built earlier - take a contact sheet of comparisons and get the individual results back out. The more interesting one is tile-based processing: if your upscaling or detail pass works better on small chunks (the same instinct behind tiled upscalers that split an image to fit VRAM), you can grid an image up, run each tile through a model, and stitch the results. It's also how you extract sprites or frames from a pre-baked atlas.

The trap: uneven divisions

This is the one thing that bites people, and it's worth saying loudly: tile size is computed with integer division, so if the image dimensions don't divide evenly by your row/column count, the leftover edge pixels are silently dropped. A 1000×1000 image into a 3×3 grid gives you 333×333 tiles and throws away the final strip. If you're doing a round trip (grid then ungrid), resize to a clean multiple of the tile size first - or just use counts that divide evenly. There's no warning, no error; the edge just vanishes.

Installing

Ships in comfyui_bmad_nodes, bmad4ever's grab-bag of API, CV, and utility nodes. ComfyUI Manager - search "comfyui_bmad_nodes" (or "Bmad Nodes") - install, restart. Manual:

cd ComfyUI/custom_nodes
git clone https://github.com/bmad4ever/comfyui_bmad_nodes
cd comfyui_bmad_nodes
pip install -r requirements.txt

Restart after. No model downloads; this node is pure PyTorch, so it doesn't even need the pack's opencv requirements.

Honest verdict: it's a simple slice-and-serve node, but paired with its grid twin it's the most reusable thing in the pack's image utilities - every "make a grid, process it, split it" workflow starts and ends here. Just remember the remainder gotcha.

CategoryBmad/image

Inputs (3)

NameTypeDefaultDescription
imageIMAGE
columnsINT31–8
rowsINT31–8

Outputs (1)

NameTypeDescription
IMAGEIMAGE