Nodes/NH-Nodes/Image Grid Composite (NH)
ComfyUI Node

Image Grid Composite (NH)

A contact sheet in one node, with gaps and padding

By jetthuangai·Created 5 months ago·Updated 21 days ago· 6
Image Grid Composite (NH)
  • images
  • image
  • slot_count
  • used_count
  • grid_info
columns2
rows2
cell_size_mode
cell_width512
cell_height512
resize_mode
gap_x0
gap_y0
background_color_hex#000000

Nobody wants to scroll through twenty preview images one at a time to find the seed they like. Image Grid Composite (NH) is the contact-sheet node: feed it an image batch and it returns one composite image laid out in a grid - 4 up, 6 up, 12 up, whatever fits. It's the "did I get a good one?" tool, and it's also the finish line for Batch Merge (NH) workflows where you've gathered images from several branches into one batch.

How it works

You get a batch in (images), a grid shape, and a pile of layout controls:

  • columns / rows - the grid dimensions (1–64 each). Slots are columns × rows; the batch fills them row by row, left to right.
  • cell_size_mode - manual uses your cell_width/cell_height; first_image takes the first image's size and uses it for every cell. First-image mode is the lazy win when all your images are already the same resolution.
  • resize_mode - what happens when a source doesn't match the cell: stretch (distort to fit), pad (fit inside with letterbox bars on background_color_hex), or fill (cover the cell, cropping overflow). pad is the safe default for mixed sources; fill looks better when the crop doesn't hurt.
  • gap_x / gap_y - spacing between cells, if you want the grid to breathe or reserve space for labels.
  • background_color_hex - the canvas color behind gaps and pad bars. #000000 is the default.

The useful outputs beyond the image

  • slot_count - columns × rows, the total capacity.
  • used_count - how many images actually landed in the grid. If used_count < slot_count, you have empty slots - either raise columns/rows or feed more.
  • grid_info - a STRING describing the layout: grid shape, cell size, resize mode, and a per-image line with each source's position and dimensions. Wire this to a text display or log it; it's a cheap audit trail for "which image ended up where."

The composite goes out as image, ready for a Save Image or Preview Image.

Where it shines

  • Seed/variation review: batch-generate, grid it, pick the winner, then re-run just that index via Batch Index (NH).
  • Output documentation: end every workflow with a grid and you get a visual log of every run.
  • Contact sheets for datasets: image folder → load → grid → one reference image.

The honest trade-off: it's a compositing node, not a layout engine. No auto-fitting to image count, no per-cell aspect magic - you set the grid and the images obey. That predictability is usually a feature.

Installing

Part of NH-Nodes:

cd ComfyUI/custom_nodes
git clone https://github.com/jetthuangai/NH-Nodes.git
cd NH-Nodes
pip install -r requirements.txt

Or search NH-Nodes in ComfyUI Manager and restart. No models, no downloads - PIL compositing.

CategoryNH-Nodes/Image

Inputs (10)

NameTypeDefaultDescription
imagesIMAGE
columnsINT21–64
rowsINT21–64
cell_size_modeCOMBO2 options: manual, first_image
cell_widthINT5121–16384
cell_heightINT5121–16384
resize_modeCOMBO3 options: stretch, pad, fill
gap_xINT00–4096
gap_yINT00–4096
background_color_hexSTRING#000000

Outputs (4)

NameTypeDescription
imageIMAGE
slot_countINT
used_countINT
grid_infoSTRING