Nodes/ComfyUI_ContactSheet_Auto/🖼️ Batch to Grid Image
ComfyUI Node

🖼️ Batch to Grid Image

The Little Node That Turns 20 Frames Into One Picture

By NexusEast·Created 8 months ago·Updated 8 months ago· 0
🖼️ Batch to Grid Image
  • images
  • IMAGE
cols4

Every now and then you want one image that shows a whole batch: the frames of a video, the outputs of a grid prompt sweep, a set of seed variations. That's Batch to Grid Image (class SimpleGridImage). It's the second half of this pack's contact-sheet workflow - the Video Interval Auto-Calc node figures out which frames to grab, and this node stitches them into a single picture. No API calls, no keys, no models. Just torch, a loop, and a canvas.

What it does, mechanically

Your batch arrives as a tensor shaped [batch, height, width, channels]. The node works out rows = ceil(batch / cols), allocates a black canvas of (1, rows*h, cols*w, c), and tiles each image in reading order - left to right, top to bottom. That's the whole implementation, and it's worth knowing two things it deliberately does not do:

  • No padding between cells. Frames butt right up against each other, mosaic-style. Great for a clean contact sheet; you won't get the little white gutters that torchvision.make_grid adds.
  • No rescaling. Every frame goes in at full resolution. A 4x5 grid of 1024x576 frames is a 4096x2880 image - huge, sharp, and heavy. Don't feed it 100 full-res frames and expect a lightweight preview.

The two inputs you'll actually set

  • images - the IMAGE batch, typically straight off a VHS load-video node or the output of a batched sampler.
  • cols - how many columns per row, default 4. The only real decision you make here.

And one output: IMAGE, a single grid image. Wire it into a Save Image or Preview Image node and you're done.

Where it shines in a real workflow

The intended loop is: Video Interval Auto-Calc → VHS Load Video → this node → Save Image. You tell the calculator you want a 4x5 grid, it picks the frames, VHS loads them, and Batch to Grid Image turns that batch into a literal contact sheet you can eyeball in one glance - useful when you're scanning a video for a good still, or sanity-checking a batch before you commit to upscaling any of it.

It's also a perfectly fine general-purpose "batch → grid" node on its own, since it'll happily take a batch from almost any source. One catch worth knowing: the grid doesn't know what grid you meant - if you set cols here to a different number than you set in the calculator, you'll still get a valid image, just not the one you planned.

Installing it

cd ComfyUI/custom_nodes
git clone https://github.com/NexusEast/ComfyUI_ContactSheet_Auto
# restart ComfyUI

Or in ComfyUI Manager, search ComfyUI_ContactSheet_Auto and install. Dependencies are just opencv-python and numpy (OpenCV is usually already present in ComfyUI's environment), no model downloads, no heavy installs. You don't even need Video Helper Suite for this node alone - VHS only matters if you want the full automated video-to-grid pipeline.

Things to watch

  • Black bars at the end. If the batch isn't an exact multiple of cols, the last row is short and the leftover space stays black. It's a contact sheet, not a mystery - that's expected, but don't file it as a bug.
  • Don't overload it. Full-res, no-downscale, all-in-RAM. For a 20-frame contact sheet it's nothing; for a few hundred it's a lot of tensor. Keep your previews small and your grids sane.
  • It's honest about being simple. Single-purpose, a few dozen lines, one commit on GitHub. That's the appeal - a utility you can read in one sitting and trust not to surprise you.

If you want gutter-padded grids, this isn't the tool - reach for the torchvision.make_grid-style nodes instead. But for a no-frills contact sheet that just works, this is the one you grab.

CategoryContactSheet

Inputs (2)

NameTypeDefaultDescription
imagesIMAGE
colsINT4

Outputs (1)

NameTypeDescription
IMAGEIMAGE