> ## Documentation Index
> Fetch the complete documentation index at: https://docs.comfy.org/llms.txt
> Use this file to discover all available pages before exploring further.

# ImageStitch - ComfyUI Built-in Node Documentation

> This node allows you to stitch two images together in a specified direction (up, down, left, right), with support for size matching and spacing between images.

This node allows you to stitch two images together in a specified direction (up, down, left, right), with support for size matching and spacing between images.

## Inputs

| Parameter Name | Description | Data Type | Input Type | Default | Range |
| - | - | - | - | - | - |
| `image1` | The first image to be stitched | IMAGE | Required | - | - |
| `image2` | The second image to be stitched, if not provided returns only the first image | IMAGE | Optional | None | - |
| `direction` | The direction to stitch the second image: right, down, left, or up | STRING | Required | right | right/down/left/up |
| `match_image_size` | Whether to resize the second image to match the dimensions of the first image | BOOLEAN | Required | True | True/False |
| `spacing_width` | Width of spacing between images, must be an even number | INT | Required | 0 | 0-1024 |
| `spacing_color` | Color of the spacing between stitched images | STRING | Required | white | white/black/red/green/blue |

> For `spacing_color`, when using colors other than "white/black", if `match_image_size` is set to `false`, the padding area will be filled with black

## Outputs

| Output Name | Description | Data Type |
| - | - | - |
| `IMAGE` | The stitched image | IMAGE |

## Workflow Example

In the workflow below, we use 3 input images of different sizes as examples:

* image1: 500x300
* image2: 400x250
* image3: 300x300

<img src="https://mintcdn.com/dripart/r1WgNOrRhVXUBgky/images/built-in-nodes/ImageStitch/workflow.webp?fit=max&auto=format&n=r1WgNOrRhVXUBgky&q=85&s=d7fc26a57f9cfe0d2f6dfa1a3cad2ab6" alt="workflow" width="2000" height="1044" data-path="images/built-in-nodes/ImageStitch/workflow.webp" />

**First Image Stitch Node**

* `match_image_size`: false, images will be stitched at their original sizes
* `direction`: up, `image2` will be placed above `image1`
* `spacing_width`: 20
* `spacing_color`: black

Output image 1:

<img src="https://mintcdn.com/dripart/r1WgNOrRhVXUBgky/images/built-in-nodes/ImageStitch/output-1.webp?fit=max&auto=format&n=r1WgNOrRhVXUBgky&q=85&s=671f720ee4cca028cc03d8abe9aecac0" alt="output1" width="500" height="570" data-path="images/built-in-nodes/ImageStitch/output-1.webp" />

**Second Image Stitch Node**

* `match_image_size`: true, the second image will be scaled to match the height or width of the first image
* `direction`: right, `image3` will appear on the right side
* `spacing_width`: 20
* `spacing_color`: white

Output image 2:

<img src="https://mintcdn.com/dripart/r1WgNOrRhVXUBgky/images/built-in-nodes/ImageStitch/output-2.webp?fit=max&auto=format&n=r1WgNOrRhVXUBgky&q=85&s=4ed7e7cbfcc3f1f35866b4472b2e517d" alt="output2" width="1090" height="570" data-path="images/built-in-nodes/ImageStitch/output-2.webp" />

> This documentation was AI-generated. If you find any errors or have suggestions for improvement, please feel free to contribute! [Edit on GitHub](https://github.com/Comfy-Org/embedded-docs/blob/main/comfyui_embedded_docs/docs/ImageStitch/en.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.