KJNodes/imagegenerated

Image Grid Composite 2x2(ImageGridComposite2x2)

This node technically uses PyTorch tensor operations to achieve concatenation.

Image Grid Composite2x2

image1
image2
image3
image4
IMAGE
KJNodes

The Image Grid Composite 2x2 node technically uses PyTorch tensor operations to achieve the stitching.

The Image Grid Composite 2x2 node is an image processing tool whose core function is to stitch four independent input images into a single 2x2 grid image. Through simple arrangement and combination, it integrates multiple pictures into one, facilitating overall preview or subsequent processing.

Node Function

This node technically uses PyTorch tensor operations to achieve the stitching. It first concatenates the first and second images horizontally (along the width dimension) to form the top row; then concatenates the third and fourth images similarly horizontally to form the bottom row; finally, it concatenates these two rows vertically (along the height dimension) to generate the final 2x2 grid image. This process requires all input images to have the same height and width; otherwise, the stitching operation will fail.

Node Parameter Description - Image Grid Composite 2x2

Inputs

Parameter NameData TypeRequiredDefault ValueRange/OptionsDescription
image1IMAGEYes--image1 (Input Parameter): The first input image to be placed in the top-left corner of the grid.
image2IMAGEYes--image2 (Input Parameter): The second input image to be placed in the top-right corner of the grid.
image3IMAGEYes--image3 (Input Parameter): The third input image to be placed in the bottom-left corner of the grid.
image4IMAGEYes--image4 (Input Parameter): The fourth input image to be placed in the bottom-right corner of the grid.

Output

Parameter NameData TypeDescription
IMAGEIMAGEIMAGE (Output Parameter): The output 2x2 grid composite image.

Usage Scenarios

In practical applications, this node is commonly used in scenarios requiring side-by-side comparison of multiple image results. For example, in a Generative Adversarial Network (GAN) workflow, you can connect images generated from different random seeds, results from different sampling steps, or outputs from different model variants to the four input ports, allowing for an intuitive comparison of their differences in a single image.

Notes

Please note that this node does not perform scaling or cropping on the images. If the four input images have inconsistent dimensions, the node will not function properly and may report an error. Ensuring that all input images have exactly the same resolution is a prerequisite for using this node.

The Image Grid Composite 2x2 node is from the ComfyUI-KJNodes node package.

Comments

Sign in with GitHub to join the discussion.

Loading comments…