Nodes/ComfyUI_agilly1989_motorway/ImageFromBatch_motorway_edition
ComfyUI Node

ImageFromBatch_motorway_edition

Pull a slice out of an image batch without a visible wire

By agilly1989·Created 2 years ago·Updated about a year ago· 7
ImageFromBatch_motorway_edition
  • MOTORWAY 🚌💨
  • MOTORWAY 🚌💨
INPUT_image_keyimage
batch_index0
length1
OUTPUT_IMAGE_keyIMAGE

Once your images live in a batch, you often need just one slice of it - the first frame of a video to condition on, a single middle frame to inspect, a handful of frames to route somewhere else. ImageFromBatch does exactly that, and ImageFromBatch_motorway_edition is the same node reading its input from and writing its output to a MOTORWAY 🚌💨 pipe.

It's part of agilly1989/ComfyUI_agilly1989_motorway, the author's key-value pipe pack. It reads the batched image out of the pipe under INPUT_image_key (default "image"), slices out a run of frames, and stores the result back under OUTPUT_IMAGE_key (default "IMAGE"). Only output is the Motorway itself.

Inputs that matter

  • INPUT_image_key (default "image") - pipe key of the batch
  • batch_index (INT, 0 to 4095, default 0) - which frame to start at (zero-based)
  • length (INT, 1 to 4096, default 1) - how many frames to pull
  • OUTPUT_IMAGE_key (default "IMAGE") - where the slice lands

The mental model is batch[batch_index : batch_index + length]. So to grab the 4th frame of a video, set batch_index to 3 and length to 1. To pull frames 0 through 9, leave batch_index at 0 and set length to 10. If batch_index + length runs past the end of the batch, you'll get an error - know how many frames you actually have.

How it works

Standard clone pattern: pop the Motorway, pull the batch out using the input key, run stock ImageFromBatch with batch_index and length, store the result under the output key, and return a cloned pipe so nothing upstream is touched. It's the natural partner to the pack's ImageBatch_motorway_edition - one stacks images into a batch, the other slices them back out.

Installing

cd ComfyUI/custom_nodes
git clone https://github.com/agilly1989/ComfyUI_agilly1989_motorway

Restart ComfyUI, or install via ComfyUI Manager (search "motorway"). No dependencies beyond ComfyUI itself, no model downloads.

Gotchas

Keys are exact and case-sensitive; a 'MotorwayClass' object has no attribute 'hash_' error means your key string doesn't match anything in the pipe yet. Also mind that the defaults read lowercase ("image") and write uppercase ("IMAGE"), so if you chain this with a clone that reads "image", nothing will be there - set the strings to agree. And the pack-wide health warning: BETA, with the motorway_edition clone family disabled in the 1.1.7 hotfix, so if the node's missing from your menu the stock ImageFromBatch is the same tool with wires.

Categoryagilly1989 Nodes/Motorway-ed/image/batch

Inputs (5)

NameTypeDefaultDescription
MOTORWAY 🚌💨MOTORWAY 🚌💨
INPUT_image_keySTRINGimage
batch_indexINT00–4095
lengthINT11–4096
OUTPUT_IMAGE_keySTRINGIMAGE

Outputs (1)

NameTypeDescription
MOTORWAY 🚌💨MOTORWAY 🚌💨