RebatchImages_motorway_edition
RebatchImages from the bus — reshape your image batches by key
- MOTORWAY 🚌💨
- MOTORWAY 🚌💨
ComfyUI works in batches, and batches have opinions. RebatchImages is the node that reshapes a pile of images into groups of a given size - it takes N images and re-batches them so each output batch holds batch_size images. It doesn't duplicate or drop anything; it just rearranges which images travel together.
Why would you care? Mostly because some downstream nodes expect a specific batch layout. A video pipeline that wants frames grouped per clip, a comparison workflow that wants each prompt's results bucketed together, or a tiling setup where the batch size controls how many tiles get processed at once - that's the Rebatch job. It's the image-side twin of RebatchLatents, and you'll often see the pair used to keep latents and decoded images in lockstep.
On the bus
The _motorway_edition version reads its input from the MOTORWAY 🚌💨 bus by key instead of by wire:
INPUT_images_key(defaultimages) - which bus key holds the image batch.batch_size(default 1, range 1–4096) - images per output batch. Default 1 means each image becomes its own batch, which is a surprisingly common thing to want.OUTPUT_IMAGE_key(defaultIMAGE) - where the reshaped batch is written back onto the bus.
The only return is the bus itself; the rebatched images live inside it under IMAGE. Keys are case-sensitive and shared by name across the whole workflow - if an upstream node parked images under a different name, change INPUT_images_key to match rather than fighting it.
One rule of thumb: if the total count isn't divisible by batch_size, the last partial batch still comes through as a smaller batch. That's by design, and downstream nodes either cope or you make the math line up upstream.
Install
No dependencies, no models - pure code:
cd ComfyUI/custom_nodes
git clone https://github.com/agilly1989/ComfyUI_agilly1989_motorway
or ComfyUI Manager → search ComfyUI_agilly1989_motorway → install → restart.
The fine print
Two pack-shaped caveats, both worth taking seriously. First, this is a self-described beta ("IF THINGS BREAK ITS BECAUSE I BROKE IT" is the README's opening), and the _motorway_edition clones were auto-generated by a cloner that build 1.1.7 disabled - a fresh install may not include this node at all. The stock RebatchImages in core is always present and does exactly the same reshaping.
Second, the bus error mode: KeyError: 'hash_...' doesn't exist in motorway means the key you referenced was never stored upstream. For a reshape node, check that your images actually landed on the bus under the name you typed before suspecting the node.
And the classic batch trap applies whether or not you use this: rebatching changes tensor shape, so a node that was happily processing one layout can start erroring on another. When a batch-oriented pipeline breaks, the first question is always "what shape did the previous node actually hand it?"
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| MOTORWAY 🚌💨 | MOTORWAY 🚌💨 | — | |
| INPUT_images_key | STRING | images | — |
| batch_size | INT | 11–4096 | — |
| OUTPUT_IMAGE_key | STRING | IMAGE | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| MOTORWAY 🚌💨 | MOTORWAY 🚌💨 | — |