图片拼接
Splice two images together in any direction
- image1
- image2
- IMAGE
Sometimes the right tool is the dumb one: stitch image2 onto image1, side by side or stacked, with optional padding. MaletteImageStitch does exactly that, in four directions, and does it without touching any model or API. The source even says where it came from: "Upstreamed from https://github.com/kijai/ComfyUI-KJNodes." So if this looks familiar, that's why.
The mechanics are the sort of thing you'd otherwise do in a PIL script. It concatenates image2 to image1 along direction - right, down, left, up (default right). If match_image_size is on (default), image2 is resized so its other dimension lines up with image1's - for left/right it matches heights, for up/down it matches widths - preserving image2's aspect ratio with Lanczos. When it's off, mismatched sizes get center-padded with a fill color instead. Optional spacing_width (even numbers only, the code rounds up) inserts a gap between the images, tinted by spacing_color (white/black/red/green/blue). If image2 isn't connected at all, the node returns image1 untouched - a handy passthrough behavior worth knowing.
The inputs
image1- required, the anchor.image2- optional; without it, nothing happens.direction,match_image_size,spacing_width,spacing_color- as above.image_urls- here's the quirk: the field exists on the node (multiline, tooltip says "optional image URLs, one per line"), but the stitch function never reads it. It's declared inINPUT_TYPESand ignored in the implementation - dead input, almost certainly leftover from a KJNodes variant that fetched URLs. Don't fill it in expecting remote fetching; wireimage2the normal way. If the node ever throws aTypeErrorin your workflow, this orphan field is the first suspect.
Output is a single IMAGE with the two images joined. Batch sizes get handled too: if image1 and image2 have different batch counts, the smaller one repeats its last frame to match.
When you'd use it
Contact sheets (the batch-concat sibling in this pack does grids; this one does simple pairs), before/after comparisons, chaining frames into a strip, or building a two-panel composition before conditioning. It's a small utility - don't expect seams to be hidden; this is a literal splice, not a panorama blender.
Installing
cd ComfyUI/custom_nodes
git clone https://github.com/jinchanz/ComfyUI-ADIC
Restart ComfyUI, or install "ComfyUI-ADIC" via ComfyUI Manager. Pure PyTorch - no pip extras, no models. If you already run ComfyUI-KJNodes, you may not need this at all; it's here mainly as a self-contained convenience.
Inputs (7)
| Name | Type | Default | Description |
|---|---|---|---|
| image1 | IMAGE | — | |
| direction | COMBO | right | 4 options: right, down, left, up |
| match_image_size | BOOLEAN | true | — |
| spacing_width | INT | 00–1024 | — |
| image_urls | STRING | 可选图片 URL,每行一个,0 个或多个 | |
| spacing_color | COMBO | white | 5 options: white, black, red, green, blue |
| image2opt | IMAGE | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| IMAGE | IMAGE | — |