Nodes/ComfyUI-Muye-nodes/宫格图像拼接
ComfyUI Node

宫格图像拼接

Put eight generations in one window instead of eight

By muyexiuluo·Created about a year ago·Updated 16 days ago· 95
宫格图像拼接
  • 图像
  • 图像
◄匹配尺寸true►
◄间隙0►
◄背景色黑色►

"Batch and pick" is the standard advice around here - it's the first mitigation the KB's troubleshooting doc lists for bad anatomy - but nobody tells you what happens after. You queue eight, and you scroll eight Preview windows one at a time, or open eight files on disk. 宫格图像拼接 (display name; the class is MuyeGridImageConcat) does what your intuition expects: images in, one grid out, three per row, side by side.

That "compare them" job is why grid nodes exist at all. rgthree's Image Comparer slides between two images; WAS Node Suite's grid combiner and KJNodes' Image Grid Composite 2x2 have been the go-to for anything more - and the 2x2 in that name is the limit. This one goes to nine.

How it works

The input handling is the interesting part, because one socket accepts three different shapes. Give it a 4-D batch tensor and it splits along the batch dimension and lays every frame into the grid. Give it a Python list of images - exactly what its sibling MuyeImageList emits - and it uses the list as-is. Give it a single image and you get a one-cell grid.

From there the arithmetic is boring and predictable, which is what you want: columns = min(3, count), rows = ceil(count / columns). Four images become 3+1, five become 3+2, six become 3x2, nine become 3x3. Anything past nine gets a console warning and is truncated to the first nine, so if your grid looks short, check the terminal.

The canvas is sized to the cell sizes plus the gaps, prefilled with the background colour, then each image is resized to its cell and pasted in. No model, no VAE, no sampling - it's all CPU-side tensors.

The inputs that matter

  • 图像 - the wire in. Batches, lists, and single images all work.
  • 匹配尺寸 - on by default. With it on, every cell is forced to the size of the first image, so a 1024x1024 and a 1536x640 land in identical boxes. Turn it off and each column takes the width of the widest image in that column, each row the height of the tallest in that row.
  • 间隙 - pixel gap between cells, 0 to 1000. Leave it at 0 for a clean contact sheet and bump it to 8–16 when you actually want the cells to read as separate pictures.
  • 背景色 - 黑色 or 白色. This is what fills the gaps and any empty slots in the last row, so with five images you'll see the background showing through where the sixth cell would be.

One output: 图像, an IMAGE you can keep wiring - into Save Image, into an upscale, back into another grid.

Install

The pack is ComfyUI-Muye-nodes by muyexiuluo. In ComfyUI Manager, search "muye" and install it, then restart. Manually:

cd ComfyUI/custom_nodes
git clone https://github.com/muyexiuluo/ComfyUI-Muye-nodes

Heads up: the pack's own README gives the clone URL as ComfyUI_Muye.git, the old repo name - use the URL above. It also tells you to pip install -r requirements.txt, and you can, but this node needs none of it: the image module imports only torch, numpy, PIL and folder_paths. Those requirements are for the captioning and face nodes (transformers>=4.50.3, uniface, scikit-image, scipy), and since every custom node shares one Python environment with no isolation, pulling them in for a grid node is a real conflict risk. Skip it unless you want the caption nodes.

Where people get burned

There is no letterboxing. Read that again before mixing aspect ratios. The node resizes with bilinear interpolation and nothing else - it does not crop, and it does not pad an image to fit a taller cell. So with 匹配尺寸 off and a 1:1 next to a 16:9 in the same column, the 1:1 gets stretched to the column width. With 匹配尺寸 on, everything gets stretched to the first image's aspect. Either way, if you care about the images looking undistorted in the sheet, resize them yourself upstream and feed the grid uniform inputs.

Old copies only drew the first image of a batch. The source header documents a fix dated 2026-10-04 for exactly this: a 4-D batch used to be treated as one image, so a batch from a KJNodes-combine node produced a grid containing image one and nobody else. If your grids come out singular, update the pack - that bug is fixed.

This node is an output node. It carries a built-in preview (it writes a temp PNG and shows it in the node), which means it will actually be executed when you queue the prompt, and it will keep your upstream branch alive even if nothing else consumes it. That's usually what you want from a terminal node. It also means the grid isn't saved anywhere permanent - wire 图像 to Save Image if you want the file.

CategoryMuye/图像

Inputs (4)

NameTypeDefaultDescription
图像IMAGE支持 4-D batch / 张量列表 / 单张,自动剔除上游补的黑图占位帧
匹配尺寸BOOLEANtrue开=所有格统一成第一张图尺寸;关=各图保持原尺寸居中
间隙INT00–1000格子之间的像素间隙
背景色COMBO黑色间隙与空格填充色

Outputs (1)

NameTypeDescription
图像IMAGE—