KJNodes/imagegenerated

Image Concatenate From Batch(ImageConcatFromBatch)

This node receives a four-dimensional tensor as input, typically with a shape of `(B, H, W, C)`, representing batch size, image height, width, and number of channels respectively.

Image Concat From Batch

images
IMAGE
num_columns
3
match_image_size
max_resolution
4096
KJNodes

The Image Concatenate From Batch node receives a four-dimensional tensor as input, typically with a shape of (B, H, W, C), representing batch size, image height, width, and number of channels respectively.

The Image Concatenate From Batch node is an image processing tool whose core function is to arrange and concatenate a batch of input images into a single grid-like image. It allows users to specify the number of columns in the grid, making it convenient to combine multiple independent images for viewing or further processing.

Node Function

This node receives a four-dimensional tensor as input, typically with a shape of (B, H, W, C), representing batch size, image height, width, and number of channels respectively. The node automatically calculates the required number of rows based on the specified number of columns and fills all images into the grid in order. It provides an optional feature to uniformly resize all images to match the dimensions of the first image. This process maintains the original aspect ratio of the images and uses the Lanczos interpolation algorithm for high-quality scaling.

Node Parameter Description - Image Concatenate From Batch

Connection Inputs (Inputs)

Parameter NameData TypeRequiredDefault ValueRange/OptionsDescription
imagesIMAGEYes--images (input parameter): The input batch of images to be concatenated, in the form of a tensor containing multiple images.

Control Parameters (Parameters)

Parameter NameData TypeRequiredDefault ValueRange/OptionsDescription
num_columnsINTYes31 - 255 (step: 1)num_columns (input parameter): Defines the number of columns in the output image grid, with a valid range from 1 to 255.
match_image_sizeBOOLEANYesFalse-match_image_size (input parameter): When enabled, resizes all input images to the same dimensions as the first image while preserving the original aspect ratio.
max_resolutionINTYes4096-max_resolution (input parameter): Sets the maximum resolution limit for the output image to prevent generating excessively large images.

Output

Parameter NameData TypeDescription
IMAGEIMAGEIMAGE (output parameter): The output single grid image after concatenation.

Usage Scenarios

This node is very useful in image generation or batch processing workflows. For example, after using the batch generation feature to create multiple image variants, you can connect this node to quickly arrange all generated results into an image grid. This facilitates intuitive comparison of generation effects under different parameters or provides convenience for creating preview images and presentation materials.

Notes

Please note that the total size of the concatenated image may be very large. The node has an internal maximum resolution parameter as a safety limit to prevent memory overflow or processing failure caused by concatenating too many or overly large images. Users should be aware of this limit and adjust the batch size or resolution of input images according to actual needs.

The Image Concatenate From Batch node is from the ComfyUI-KJNodes node package.

Comments

Sign in with GitHub to join the discussion.

Loading comments…