Nodes/Comfyui-XYZ-stitch/XYZ Grid Stitch
ComfyUI Node

XYZ Grid Stitch

Turning Nine Images Into a Labeled Grid

By psdwizzard·Created 10 months ago·Updated 10 months ago· 3
XYZ Grid Stitch
  • images
  • grid_image
x_labelsred, blue, green
y_labels1, 2, 3
z_labels
label_height120
label_width150
gap_size4
layout_styleA1111 Style (X blocks)
is_completetrue

This is the node you've been working toward. XYZ Grid Stitch takes all the images your sweep collected, arranges them into a grid, and paints labels on top - the A1111-style comparison sheet that makes parameter testing actually legible instead of a wall of similar-looking images. Every other node in this pack feeds this one.

The mechanism is pure PIL. It parses your label lists, assumes every incoming image is the same size, and pastes them into a canvas with axis labels drawn in the margins. Nothing clever, which is exactly what you want from the final step.

The is_complete gate - don't skip this

The single most important connection in the pack. Stitch takes an optional is_complete input that defaults to true, and that default will bite you. If you forget to wire it, the node stitches on every run - your "grid" is a 1×1 image of whatever you just made, over and over.

Connect the Auto Collector's is_complete output to Stitch's is_complete input, and the behavior flips: while the sweep is running, Stitch sees false and returns a tiny black placeholder instead of a real grid. The "Skipping - waiting for all images to be collected" message in the console is normal, not an error. Only on the final run does is_complete go true and the real grid materialize.

The inputs that matter

  • images - the batch from the Auto Collector.
  • x_labels, y_labels, z_labels - comma-separated labels. These are the text that ends up on the grid, so make them short enough to actually fit. Leave z_labels empty for a 2D grid.
  • label_height (default 120) and label_width (default 150) - how much canvas the top and left label areas take. Cut-off labels mean bump these up.
  • gap_size (default 4) - spacing between cells.
  • layout_style - the interesting one, with two choices:
    • A1111 Style (X blocks) - each X value gets its own block containing a Y×Z sub-grid. This is the classic layout and the default.
    • Z Horizontal - each Z value gets a full 2D grid, and the grids sit side by side.

Output is a single grid_image tensor, ready for a Save Image or Preview node.

Where people get burned

Mixed image sizes are the classic trap. The node takes the dimensions of the first image and assumes the rest match - generate at a fixed resolution for the whole sweep or your grid comes out mangled. If labels look tiny, that's usually the font fallback: it tries arial.ttf and falls back to PIL's tiny default font on systems without arial installed (a common Linux thing), which is when you crank label_height/label_width well past the defaults. And again, no is_complete wire means instant broken output - it's the first thing to check when you're getting 1×1 images.

Installing

One pack, one install. ComfyUI Manager → search "XYZ Grid", or:

cd ComfyUI/custom_nodes/
git clone https://github.com/psdwizzard/Comfyui-XYZ-stitch.git

Restart ComfyUI. No extra dependencies - torch, PIL, and numpy, all already in ComfyUI.

CategoryXYZ Grid

Inputs (9)

NameTypeDefaultDescription
imagesIMAGE
x_labelsSTRINGred, blue, greenComma-separated labels for X axis (columns)
y_labelsSTRING1, 2, 3Comma-separated labels for Y axis (rows)
z_labelsSTRINGComma-separated labels for Z axis (separate grids)
label_heightINT1200–300Height in pixels for label area (top) - increased for larger fonts
label_widthINT1500–300Width in pixels for Y label area (left) - increased for larger fonts
gap_sizeINT40–50Gap size between images in pixels
layout_styleCOMBOA1111 Style (X blocks)A1111: Each X value gets a block with Y×Z grid inside | Z Horizontal: Z values create grids side-by-side
is_completeoptBOOLEANtrueOnly stitch when True (connect from Auto Collector)

Outputs (1)

NameTypeDescription
grid_imageIMAGE