Multi-Batch Combine
Eight Image Batches, One Tensor, Zero Fiddly Size Matching
- batch_1
- batch_2
- batch_3
- batch_4
- batch_5
- batch_6
- batch_7
- batch_8
- images
- total_frames
ComfyUI will happily let you wire two image batches of different sizes into a single downstream node and then fail, confusingly, deep in the graph. This node removes the whole class of problem: it concatenates up to eight image batches into one output tensor, auto-resizing anything that doesn't match, so whatever you throw at it comes out as a single uniform batch. The classic use is merging chunks of generated video frames or image sets before a single save or upscale pass.
How it works
Up to eight optional inputs (batch_1 through batch_8) - unconnected ones are simply skipped, so a graph with three batches wired and five empty is a valid graph. When more than one batch is present, it picks a target size based on size_mode and resizes everything to it with resize_method, then concatenates along the batch dimension.
The size_mode choice is the only real decision:
largest(default) - resize everything up to the max width and height across all batches. Nothing gets shrunk, so no detail loss on the smaller sources; the big ones stay untouched.first- match the dimensions of the first connected batch. Handy when batch 1 defines the format and the others are just extras to line up with it.custom- usetarget_width/target_heightexplicitly. Full control, but you have to know your numbers.
resize_method is bilinear (default), nearest, bicubic, or area. Nearest for pixel art, area for heavy downscales, bilinear/bicubic for photos. All of it runs through F.interpolate on the GPU, so the resize cost is trivial.
Two behaviors worth knowing: with a single batch connected it's a pure passthrough (returns the batch untouched plus its frame count), and with nothing connected it raises - it won't silently hand you an empty tensor. The outputs are images (the combined batch) and total_frames (its length), the latter being genuinely handy when a downstream node wants to know how many frames it's about to process.
Why you'd reach for it
The pack's own "Cowboy" loaders (Video Folder Cowboy, Image Folder Cowboy) each produce a batch per directory, and when you're mixing sources - several reference folders, multiple video clips, a few image sets - you end up with N batches that all want to be one. This is the join node. It's also the sane way to build a contact sheet or comparison grid upstream of a single grid-arrange step.
Installing it
Part of TrentNodes; one install covers the whole pack:
cd ComfyUI/custom_nodes
git clone https://github.com/TrentHunter82/TrentNodes.git
cd TrentNodes
pip install -r requirements.txt
ComfyUI Manager ("Trent Nodes") works too, with the recurring caveat that the author's day-one repo rename left a duplicate registry entry that occasionally makes Manager flag the pack as "unsafe" - the manual clone is the reliable fallback. Pure torch here; no model downloads.
Where people get burned
- Unexpected resizing - default
largestmeans every batch gets resized to the biggest, which can soften your small high-detail images. If aspect ratios vary wildly, resize is a compromise no matter what;firstis the least surprising mode when one batch defines the format. - Forgetting the single-batch passthrough - with one batch wired it returns it unchanged, which looks like nothing happened. It didn't. That's the feature.
Inputs (12)
| Name | Type | Default | Description |
|---|---|---|---|
| size_mode | COMBO | largest | How to handle size mismatches: largest (resize to max dimensions), first (match first batch), custom (use target_width/height) |
| resize_method | COMBO | bilinear | Interpolation method for resizing |
| batch_1opt | IMAGE | First image batch | |
| batch_2opt | IMAGE | Second image batch | |
| batch_3opt | IMAGE | Third image batch | |
| batch_4opt | IMAGE | Fourth image batch | |
| batch_5opt | IMAGE | Fifth image batch | |
| batch_6opt | IMAGE | Sixth image batch | |
| batch_7opt | IMAGE | Seventh image batch | |
| batch_8opt | IMAGE | Eighth image batch | |
| target_widthopt | INT | 51264–8192 | Target width when size_mode is 'custom' |
| target_heightopt | INT | 51264–8192 | Target height when size_mode is 'custom' |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| images | IMAGE | — |
| total_frames | INT | — |