Nodes/ComfyUI_DD_Nodes/DD Image Batch
ComfyUI Node

DD Image Batch

Glue two images together without the shape errors

By digital-divas-admin·Created 7 months ago·Updated 5 months ago· 0
DD Image Batch
  • image_a
  • image_b
  • image

Batching is how ComfyUI processes multiple images in a single pass - and it's also where beginners hit their first "shape mismatch" wall. DD Image Batch takes two images and stacks them into one batch tensor. Nothing fancy, but there's one behavior that makes it genuinely friendlier than most batch nodes: if the two images aren't the same size, it silently resizes the second one to match the first before joining. No error, no manual pre-resize.

Why you'd bother

ComfyUI batches images by stacking them on the batch (first) dimension. A batch of two images is one tensor where the sampler, VAE, or encoder processes both in a single operation instead of two. That's the whole trick behind generating multiple variations, running img2img over several references, or feeding a grid of frames into an upscaler. The annoying part is that everything in a batch has to share one height and width - and core ComfyUI's own batch nodes will just error out if you hand them mismatched sizes. This one papers over that.

How it works

Under the hood it's a torch.cat along the batch axis. If image_a and image_b already match in dimensions, it's a plain join - no pixels touched. If they don't, image_b gets bilinearly resized to image_a's height and width first. The order in the output matters: image_a's frames come first, then image_b's. When you're building a comparison grid or a "before/after" pair, wire your primary image into image_a so it lands first.

Inputs and output

  • image_a - the reference image (sets the final batch dimensions).
  • image_b - the second image, resized to match if needed.
  • Output: image - a single IMAGE tensor containing both, stacked.

Where the footgun hides

That auto-resize is convenient, but it's also silent and lossy. If image_b is a wildly different aspect ratio, it gets stretched to match image_a - that's a distortion, not a smart crop. If you care about how the second image looks, resize it yourself first with DD Image Resize so you control the method. The friendly fallback is exactly the right call for "just don't crash," and exactly the wrong one for "preserve my composition."

Installing it

Part of the ComfyUI_DD_Nodes pack by Digital Divas. Via ComfyUI Manager search "DD Nodes", or:

cd ComfyUI/custom_nodes
git clone https://github.com/digital-divas-admin/ComfyUI_DD_Nodes.git

Restart ComfyUI. requirements.txt is empty - no extra dependencies, no models to download. Worth repeating because it bites people: an unrelated project also calls itself "ComfyUI-DD-Nodes," so when you search Manager, verify the repo is digital-divas-admin/ComfyUI_DD_Nodes first.

CategoryDD Nodes/Image

Inputs (2)

NameTypeDefaultDescription
image_aIMAGE
image_bIMAGE

Outputs (1)

NameTypeDescription
imageIMAGE