Append to Image List (XJ)
Grow an image list one picture at a time — the accumulator for loops
- image_list
- image
- list
ComfyUI batches are great when every frame is the same shape, but real pipelines keep producing images one at a time - inside loops, from separate branches, from a folder loader with mixed content. XJAppendImageList is the node that lets you accumulate those images into a Python-style list, one append at a time, so you can collect first and process or save all of it later.
It's one half of a deliberately simple pattern in the ComfyUI-XJNodes pack: XJEmptyImageList creates the empty container, this node appends to it, and XJImageListLength, XJGetImageFromList, and XJImageListSlice let you inspect and carve it back up. Think of it as the image-flavored version of building up a list in any scripting language - ComfyUI just makes you do it with nodes.
How it works
The mechanism is where this node earns its keep, because it smooths over the two things that make image lists fiddly in ComfyUI:
- It accepts a real list. The
image_listinput is marked as a list input (INPUT_IS_LIST), so it consumes the Python list that anXJEmptyImageListor a previous append produced - not a batch tensor. - It splits batches for you. If the
imageyou're appending is actually a batch tensor with more than one frame, it breaks it into individual images and appends each one separately. Feed it a batch of 4 and your list grows by 4 entries, which is the behavior you'd want for a folder of crops but not the behavior naive node writers produce.
There's a deliberate validation quirk: if image_list isn't a Python list, it raises an error instead of silently misbehaving. That error message is your friend - it means you've wired a batch tensor into the list slot, which is the one real mistake people make with this node.
The inputs and outputs
image_list(IMAGE, list) - the accumulator to append to. Start it fromXJEmptyImageList.image(IMAGE) - the image (or batch) to add.- Output:
list(IMAGE, list) - the grown list, ready to feed back into this node, into a slice, or into a saver that accepts lists.
Installing it
It's part of ComfyUI-XJNodes:
cd ComfyUI/custom_nodes
git clone https://github.com/alexjx/ComfyUI-XJNodes
then restart ComfyUI (or ComfyUI Manager → search ComfyUI-XJNodes). No models, no dependencies beyond stock ComfyUI.
Common issues
The image_list must be a list error is the headline gotcha - it means you connected a plain IMAGE output (a batch) into the list slot. The pack's own loop system was explicitly built to preserve lists without auto-expanding them, so inside its loops the accumulation pattern stays intact; with other loop packs, double-check the loop passes the list through unwrapped. Beyond that, remember the append mutates the list you pass in - ComfyUI re-executes nodes each run, so a fresh XJEmptyImageList upstream is what guarantees you don't accumulate stale frames across runs.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| image_list | IMAGE | — | |
| image | IMAGE | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| list | IMAGE | — |