KJNodes/imagegenerated

Image Concatenate(ImageConcanate)

This node technically supports stitching along four directions (right, down, left, up).

Image Concanate

image1
image2
output
direction
right
match_image_size
KJNodes

The Image Concatenate node technically supports concatenation along four directions (right, down, left, up).

The Image Concatenate node is an image processing node whose core function is to concatenate two inputs (image1 and image2) – which can be either images or masks – into a new output along a specified direction. It provides users with an intuitive way to combine visual elements and serves as a foundational tool for building complex image layouts.

Node Functionality

Technically, this node supports concatenation along four directions (right, down, left, up). When the match_image_size option is enabled, it automatically adjusts the size of the second image to match the size of the first image along the concatenation direction, ensuring neat edges. When disabled, if the dimensions don't match along the shared axis, the smaller image is centered and zero-padded instead of causing an error. Additionally, if image2 is a different type (image vs mask) than image1, it is converted automatically: image → mask conversion uses the RGB mean, while mask → image conversion replicates the single channel across RGB channels. Internally, the node also handles cases where the batch sizes of the input images are inconsistent by repeating the last image to align the batches, ensuring output stability.

Node Parameter Description - Image Concatenate

Connection Inputs (Inputs)

Parameter NameData TypeRequiredDefault ValueValue Range/OptionsDescription
image1IMAGE / MASKYes--image1 (Input Parameter): The first input (image or mask) serving as the concatenation reference. The output type matches this input's type.
image2IMAGE / MASKYes--image2 (Input Parameter): The second input (image or mask) to be concatenated onto the first. If its type differs from image1, automatic conversion is applied.

Control Parameters (Parameters)

Parameter NameData TypeRequiredDefault ValueValue Range/OptionsDescription
directionCOMBOYesright"right", "down", "left", "up"Direction to concatenate image2 onto image1.
match_image_sizeBOOLEANYesTrue-match_image_size (Input Parameter): Boolean, defaults to True. When enabled, automatically adjusts the size of the second image to match the size of the first image along the concatenation direction. When disabled, mismatched dimensions are handled by centering and zero-padding the smaller image.

Output

Parameter NameData TypeDescription
IMAGE / MASKIMAGE / MASK (same as image1)Output (Output Parameter): The new image or mask generated after concatenation is complete. Its type follows image1.

Usage Scenarios

In specific workflows, this node is commonly used to create comparison images or collages. For example, in image generation or editing pipelines, you can input the original image and the stylized image separately, then choose the "right" or "down" direction for concatenation, allowing side-by-side display of the before-and-after effects for intuitive comparison.

Notes

It is important to note that when the concatenation direction is "left" or "up", image2 will be concatenated to the left or above image1. The order of the images affects the final visual outcome. Additionally, if the input images have vastly different sizes and size matching is not enabled, the smaller image is centered and zero-padded rather than cropped. When working with masks, be aware of the automatic type conversion if the inputs differ (image vs. mask).

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

Comments

Sign in with GitHub to join the discussion.

Loading comments…