Nodes/KJNodes for ComfyUI/Image Grid To Batch
ComfyUI Node Runs on cloud

Image Grid To Batch

Slice a contact sheet back into frames

By kijai·Created 3 years ago·Updated about 16 hours ago· 2,930
Image Grid To Batch
  • image
  • IMAGE
columns3
rows0

Sometimes you end up with a grid - a 3×2 contact sheet, an XY plot, a sprite sheet, or a model that spits out several results tiled into one image - and you actually want the cells as separate images. Image Grid To Batch does exactly that: it cuts a single grid image into a batch, one image per cell. It's the inverse of the "make a grid" nodes, and it's the cleanest way to recover individual frames from something that got tiled together.

It's part of KJNodes, kijai's utility pack. No model behind it - just slicing.

How it works

You tell it how the grid is laid out and it divides the image evenly into that many cells, then emits each cell as an entry in the output batch, in reading order - left to right, top to bottom. Because the split is even, it's assuming a clean grid with no gutters: it carves the image into equal rectangles based on your row and column counts.

The inputs and output that matter

  • image - the grid image to slice.
  • columns - how many columns the grid has (default 3). This is the one you'll almost always set.
  • rows - how many rows. Left at 0 it infers the row count from the columns and the image shape, which is handy when you know the width of the grid but not the exact height.

The output is an IMAGE batch - one image per cell, ready to feed anything that takes a batch (a video-combine, a save, a per-image process).

Installing it

ComfyUI Manager → search KJNodes for ComfyUI → install → restart. Or cd ComfyUI/custom_nodes && git clone https://github.com/kijai/ComfyUI-KJNodes, then pip install -r ComfyUI-KJNodes/requirements.txt, and restart.

Where people get burned

  • Borders and padding wreck it. The slice is even and border-blind. If your grid has gutters, labels, or a margin - the way many XY-plot exports do - every cell will include a sliver of its neighbor or a strip of background. Feed it a borderless grid, or crop the margins off first.
  • Wrong row/column counts. Get the layout numbers wrong and you'll cut cells in half. If the output looks shifted, your columns/rows don't match the actual grid. When in doubt, set both explicitly rather than trusting the rows: 0 inference on an unusual aspect ratio.
  • Uneven grids. A grid where the last row is partially filled won't slice cleanly - the node expects full, even rows and columns.
CategoryKJNodes/image

Inputs (3)

NameTypeDefaultDescription
imageIMAGE
columnsINT31–8The number of columns in the grid.
rowsINT01–8The number of rows in the grid. Set to 0 for automatic calculation.

Outputs (1)

NameTypeDescription
IMAGEIMAGE