Image Batch to Image List
Unpack an image batch into an actual list of images
- image_batch
- image
- alpha
ComfyUI makes a quiet but important distinction between a batch of images - one big tensor stacked along the first dimension - and a list of images - a Python list of separate tensors that some nodes iterate over one by one. ImageBatchtoImageList is the converter between them, but with a twist specific to this pack: the image_batch it consumes isn't a ComfyUI tensor at all. It's the pack's own image_batch type, produced by Load Image Batch, which is just a list of file paths on disk.
So this node's real job is: take those paths, load every file, and hand you a proper Python list of image tensors plus a parallel list of alpha masks - the exact shape that list-iterating nodes expect. The name is almost a red herring; the node is the "make paths into tensors" step that connects the pack's batch loader to the rest of the ecosystem.
How it works
For each path it first tries ComfyUI's VideoFromFile component loader, which means it handles more than still images - animated GIFs and video files get read frame-by-frame, which is why you can feed a batch directory of clips and get a list of their frames. If that path doesn't produce frames, it falls back to plain PIL: each image is EXIF-transposed, converted to RGB, and, if it has an alpha channel, a mask is built from it. The alpha output is the inverted alpha - white where transparent, which is ComfyUI's mask convention - and frames of mismatched size inside one file are skipped.
Inputs and outputs
image_batch(image_batch) - the pack's batch type from Load Image Batch (or Load Image from ZIP).
Two outputs, both lists:
image(IMAGE, list) - one tensor per source image/frame.alpha(MASK, list) - one mask per image, white = transparent.
Installing it
Part of ComfyUI-lhyNodes:
- ComfyUI Manager → search
lhyNodes→ Install, restart. - Or manually:
cd ComfyUI/custom_nodes
git clone https://github.com/lihaoyun6/ComfyUI-lhyNodes.git
python -m pip install -r ComfyUI-lhyNodes/requirements.txt
Restart ComfyUI.
Where people get burned
The outputs are lists, not batches - a node that expects a single stacked IMAGE tensor will reject them. That's the sibling node's job (ImageBatchtoImages stacks into one tensor); reach for this one when you're feeding something that iterates, like per-frame processing or a loop-style node. Also, "batch" here is the pack's file-path type, so you can't wire a normal IMAGE output from, say, a KSampler into it - it will not be in the dropdown, because that's a different data type entirely. If the output list order ever seems random, check your Load Image Batch folder ordering; this node preserves the order it's given.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| image_batch | image_batch | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| image | IMAGE | — |
| alpha | MASK | — |