ComfyUI Node

Collage

A contact sheet in one node, no layout math required

By Kinburg·Created 3 months ago·Updated 6 days ago· 1
Collage
  • input_images
  • background_image
  • image
output_width2480
output_height3508
cols3
gap10
margin20
background_color#FFFFFF
folder_path

Every so often you want all the images from a run on one canvas - a contact sheet, a storyboard grid, a batch preview you can actually look at instead of scrolling 40 preview windows. The pack's Collage node does exactly that: images in, one grid on a canvas out, and the layout math (cell sizes, rows, spacing) handled for you.

The source can be either a wired input_images batch or, if nothing is connected, every image in a folder_path (natural-sorted, so img2 sorts before img10 - the classic filename trap dodged). Each image is fit into its grid cell with its aspect ratio preserved, letterboxed rather than squashed. The nice detail: the letterbox border is filled with the image's own top-left pixel color, so a dark image on a dark background blends in instead of showing white bars.

The inputs that matter:

  • output_width / output_height - the canvas size in px. The defaults (2480×3508) are roughly A4 portrait; change to taste.
  • cols - column count; rows are derived from the image count.
  • gap / margin - spacing between cells and the outer frame, in px.
  • background_color - canvas color (used when no background image is connected).
  • input_images - the batch to arrange. If not connected, it loads from folder_path instead.
  • background_image - optional; stretched to the output size and overrides the solid color (first frame only).

The output:

  • image - the collage as an IMAGE, ready for a preview or save node.

One decision you should make up front: the canvas is fixed-size and the cells derive from it, so a batch of portrait images in a portrait canvas fills more evenly than mixed orientations. That's not a bug - it's the grid doing what you asked. If you want a different feel, change cols, not the images.

Where people get burned: connect nothing to input_images and leave folder_path empty, and the node raises a clear error telling you exactly that. Feed it an empty batch and it returns the bare background rather than crashing. It also skips unreadable files in a folder with a console note instead of dying mid-load, which is the kind of robustness that saves a long run.

Install via ComfyUI Manager (search "Kinburg-Nodes") or:

cd ComfyUI/custom_nodes
git clone https://github.com/Kinburg/Kinburg-Nodes

then restart. No extra dependencies - Pillow, numpy and torch all ship with ComfyUI (the README explicitly calls this out), so there's nothing to download beyond the pack. One-author personal collection, per-package docs, and a 1395-check test suite.

CategoryKinburg-Nodes/image

Inputs (9)

NameTypeDefaultDescription
output_widthINT24801–16384Width of the output collage, in px.
output_heightINT35081–16384Height of the output collage, in px.
colsINT31–100Number of columns; the row count is derived from the image count.
gapINT100–2000Spacing between cells, in px.
marginINT200–2000Outer margin around the grid, in px.
background_colorSTRING#FFFFFFCanvas color as HEX (#RRGGBB), used when no background_image is connected.
input_imagesoptIMAGEImages to arrange. If not connected, images are loaded from folder_path instead.
background_imageoptIMAGEOptional background, stretched to the output size. Overrides background_color (first frame only).
folder_pathoptSTRINGFallback source: load every image in this folder (natural-sorted) when input_images isn't connected.

Outputs (1)

NameTypeDescription
imageIMAGE