Nodes/ComfyUI-ZhiHui/🪣 智绘_九宫格拼图
ComfyUI Node

🪣 智绘_九宫格拼图

The grid assembler with cell-size control

By zhuyungen·Created 8 months ago·Updated 4 months ago· 0
🪣 智绘_九宫格拼图
  • images
  • grid_image
◄columns3►
◄rows3►
◄background_colorblack►
◄max_cell_size0►

Contact sheets. Compare-sheets. Style matrices. Whatever you call them, the "stack a batch of images into a grid" node is one of the most useful boring tools in ComfyUI - it's how you look at nine LoRA variants, sixteen seeds, or a grid of checkpoint outputs at a glance. ZH_GridImageAssembler (🪣 智绘_九宫格拼图) is the 智绘灵箱 pack's version: IMAGE batch in, one gridded IMAGE out, with explicit columns × rows control and a per-cell size cap that keeps huge batches from eating your VRAM.

How it works

It takes your batch, defines a grid of columns × rows cells, letterboxes each image to a uniform cell size, and tiles them onto a canvas with a background_color (black or white) filling any leftover space. Two behaviors matter if you're pushing it hard:

  • Grid capacity = columns × rows. Feed it more images than the grid holds and the excess is simply truncated - the pack's own docs say it: 超出容量会被截断. If you expect all 20 images in a 3×3 grid, you're going to be surprised. Either match the grid to the batch size or accept the truncation.
  • max_cell_size (0 = unlimited) caps the longest side of each cell before compositing. This is the VRAM/IO control: on a big batch, capping cells to 512 or 1024 keeps the assembled canvas (and the tensors it makes) manageable. It must be a multiple of 64 - the tooltip and docs both call this out, so don't feed it 700.

Cell sizing follows the largest image in the batch (up to the cap), and each image is scaled into its cell preserving aspect ratio with letterboxing to the background color - so mixed-aspect images still come out as a tidy, aligned sheet.

The inputs that matter

images in, and then really just three knobs: columns and rows (1–20 each, so anything from a 1×1 up to a 20×20 sheet) define the layout, and max_cell_size is the one you'll touch when a big batch makes the output unwieldy. background_color (black/white) is a taste call. Output is a single grid_image (IMAGE) - straight into a preview or save.

Install

Part of the 智绘灵箱 (ComfyUI-ZhiHui) pack:

cd ComfyUI/custom_nodes
git clone https://github.com/zhuyungen/ComfyUI-ZhiHui.git

Restart ComfyUI (or ComfyUI Manager, "智绘灵箱" / "ComfyUI-ZhiHui"). Pillow-only at runtime.

Where people get burned

  • Silent truncation is the #1 trap. A 10-image batch into a 3×3 grid shows you eight images and never says a word. Count your inputs before you run, or set columns×rows ≥ batch size.
  • max_cell_size is not "image size." It caps how big each cell can be; images smaller than the cap stay at their own size, and the grid auto-sizes to the largest cell. Want fixed cells? Set all inputs to the same size and it'll behave.
  • Black background ≠ transparent. If you're compositing the grid over something, the letterbox bars are baked in. There's no alpha option here.
  • The pack has a second, fancier layout node (ZH_ImageLayout) with borders, gaps and custom RGB - if you need a prettier sheet than a raw contact grid, that's the one.

For its niche it's bulletproof and boring in the good way. Generate a batch, grid it, eyeball it - the fastest QA loop in the tool. And when you're tired of the plain black-on-white look, ZH_ImageLayout is the upgrade path with borders and spacing.

Category智绘灵箱/图片

Inputs (5)

NameTypeDefaultDescription
imagesIMAGE—
columnsINT31–20—
rowsINT31–20—
background_colorCOMBOblack2 options: black, white
max_cell_sizeINT00–8192—

Outputs (1)

NameTypeDescription
grid_imageIMAGE—