Image Grid Composite (NH)
A contact sheet in one node, with gaps and padding
- images
- image
- slot_count
- used_count
- grid_info
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 -
manualuses yourcell_width/cell_height;first_imagetakes 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).padis the safe default for mixed sources;filllooks 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.
#000000is 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.
Inputs (10)
| Name | Type | Default | Description |
|---|---|---|---|
| images | IMAGE | — | |
| columns | INT | 21–64 | — |
| rows | INT | 21–64 | — |
| cell_size_mode | COMBO | 2 options: manual, first_image | |
| cell_width | INT | 5121–16384 | — |
| cell_height | INT | 5121–16384 | — |
| resize_mode | COMBO | 3 options: stretch, pad, fill | |
| gap_x | INT | 00–4096 | — |
| gap_y | INT | 00–4096 | — |
| background_color_hex | STRING | #000000 | — |
Outputs (4)
| Name | Type | Description |
|---|---|---|
| image | IMAGE | — |
| slot_count | INT | — |
| used_count | INT | — |
| grid_info | STRING | — |