π¦ Image Grid Batch (nhk)
Stack unlimited images into one batch β despite the name, it's not a visual grid
- batch
- batch_count
Let's clear up the name immediately: ImageGridBatch does not make a visual grid. It stacks images into a batch tensor - one tensor where multiple images ride along the batch dimension - so a downstream node processes them all in one go. If you want a pretty contact-sheet grid, that's its sibling ImageGridComposite. If you want to feed, say, ten images into one sampler or one VAE decode as a batch, this is the node.
This one exists to fix a specific ComfyUI annoyance: most built-in nodes give you a fixed number of image inputs - usually three to six - and you run out fast. ImageGridBatch takes as many as you can connect, with sockets that appear on the fly as you wire them in. It's the dynamic-input pattern the whole nhknodes pack leans on, applied to the batch use case.
How it works
Mechanically it's almost insultingly simple, which is why it's reliable. The node collects every connected input that is a tensor (its dynamic sockets only accept IMAGE), then runs torch.cat(images, dim=0) - concatenating along the batch axis. If you connect three 1Γ512Γ512Γ3 images, you get one 3Γ512Γ512Γ3 tensor out. The output is displayed as separate images in the batch preview, not as a single composite, which is the honest way to show what it did.
Two outputs: batch (the stacked IMAGE tensor) and batch_count (INT - how many images went in, handy for a progress readout or downstream batch logic).
The one real constraint
Because it's torch.cat along the batch dimension, every image must share the same height, width, and channel count. A 512Γ512 and a 768Γ512 won't stack - you'll get a shape mismatch error, not a graceful fallback. If your sources have mixed sizes, run them through an image resize node first (the pack's VisualResizer, or any resize/scale node) to normalize before the batch.
There's also no auto-wrapping: connect a batch to itself and you'd concatenate batch-with-batch (each input can itself be a multi-image batch), which is a feature - it's how you merge two existing batches.
Installing
Same as the rest of the pack:
cd ComfyUI/custom_nodes
git clone https://github.com/Enashka/ComfyUI-nhknodes
or ComfyUI Manager β search "NHK Nodes" β install β restart. Under nhk/image, no extra dependencies.
Where people get burned
- Shape mismatch errors. Mixed resolutions in, crash out. Normalize sizes upstream - it's the #1 mistake and the fix is a resize node.
- "I expected a contact sheet." You picked the wrong sibling. ImageGridComposite is the visual one; ImageGridBatch is the batch one. Easy to confuse because the pack names them so similarly.
- Nothing connected. The node returns an empty batch (
0Γ0Γ0Γ3) withbatch_count0 instead of erroring. If your downstream node silently produces nothing, check that you actually connected images.
For multi-image processing - batch inpainting, batch VAE decode, feeding several reference frames into a video model at once - ImageGridBatch is the shortest path to "many images, one tensor." It won't win any awards for excitement, but it's the kind of utility that quietly unblocks a dozen workflows.
Inputs (0)
No inputs
Outputs (2)
| Name | Type | Description |
|---|---|---|
| batch | IMAGE | β |
| batch_count | INT | β |