Nodes/ComfyUI-TinyBee/Grid Divider
ComfyUI Node

Grid Divider

Split a Contact Sheet Back Into Individual Images

By TinyBeeman·Created about a year ago·Updated about a month ago· 1
Grid Divider
  • grid_image
  • images
  • cell_width
  • cell_height
cols2
rows2

Somewhere between "make a grid of my outputs" and "process each image individually" there's a gap: you have a grid image - a contact sheet, a comparison layout, a 2×2 test - and you need the individual cells back as separate images. Grid Divider is that inverse operation. Feed it a grid image and the number of columns/rows, and it slices it into a batch of cell images plus the computed cell size. It's the cleanup half of a workflow that most packs only give you the "make grid" half of.

How it works

Three inputs, three outputs:

  • grid_image - the grid, as a normal IMAGE.
  • cols and rows - how many cells across and down. Defaults to 2×2.

Outputs:

  • images - the cells, as an IMAGE batch (index 0 = top-left, then left-to-right, row by row).
  • cell_width / cell_height - the computed size of each cell, in pixels.

The splitting math is integer division: cell_width = image_width // cols, cell_height = image_height // rows. Two consequences fall out of that. First, if your grid dimensions aren't cleanly divisible by cols/rows, the last partial column and row are dropped - a 1000px-wide image split into 3 columns gives you 333px cells and ignores the leftover pixel column. Second, cells are just cropped out, never resized, so all cells are exactly cell_width × cell_height.

The output batch plays nicely with the rest of the image workflow - feed it into TinyBee's Images From Batch to unpack individual outputs, or into per-image processing. And the cell_width/cell_height outputs let you recompute grid coordinates later if you need to, say, place something back at the original cell positions.

Where you'd actually use it

  • Unpack comparison sheets: split a multi-cell preview back into originals for separate upscaling or detail passes.
  • Contact-sheet recovery: reverse a grid you made earlier (the pack's Grid Maker is the forward direction).
  • Tile processing: split an image into uniform tiles, process each, re-grid.

Installing it

Part of ComfyUI-TinyBee under 🐝TinyBee/Images:

  1. ComfyUI Manager → Install Custom Nodes → search "ComfyUI-TinyBee" → Install, then restart ComfyUI.
cd ComfyUI/custom_nodes
git clone https://github.com/TinyBeeman/ComfyUI-TinyBee

Restart. No models; the only real dependency is torch (for the tensor slicing), which ComfyUI obviously already has. The pack's requirements.txt (pillow, jsonata) isn't involved in the cell extraction.

Gotchas

The dropped-edge-pixels behavior is the thing that'll surprise you on non-divisible grids. If you built the grid yourself, keep the original cols/rows handy and it's a non-issue; if you're splitting an arbitrary sheet, check that grid_width % cols == 0 (and same for height) or you'll silently lose the ragged edge. Also, if the input is None or malformed, the node returns a single black 64×64 image rather than failing - a reasonable defensive default, but it means a bad input produces a garbage cell instead of a visible error. And cells are stacked into one batch, so you'll typically follow with Images From Batch to get separate IMAGE wires for each cell.

Category🐝TinyBee/Images

Inputs (3)

NameTypeDefaultDescription
grid_imageIMAGE
colsINT21–4096
rowsINT21–4096

Outputs (3)

NameTypeDescription
imagesIMAGE
cell_widthINT
cell_heightINT