Empty Image List (XJ)
The empty list you need before you can grow one
- list
In code, building a list means starting with [] and appending. ComfyUI has no such syntax, so the pack that wants to give you image lists has to ship the empty list as a node. XJEmptyImageList is that node: it produces an empty image list - literally nothing - which you then feed into XJAppendImageList to start accumulating.
It looks like the most pointless node in the ComfyUI-XJNodes pack, and in isolation it is. But as the seed of the list-building pattern, it's the difference between a workflow that collects images across a loop and one that can't. Pair it with the pack's append, length, index, and slice nodes and you have a tiny image-list toolkit without pulling in a heavyweight pack.
How it works
The implementation is a single line of intent: it returns ([],) - a Python empty list, wrapped so ComfyUI knows the output is a list (OUTPUT_IS_LIST). That marker is the crucial bit. Because the output is flagged as a list type, the next node that consumes it - XJAppendImageList, XJImageListLength, and the rest of the pack's list nodes all declare themselves list-aware - receives an actual Python list rather than a batch tensor, and the accumulation math works the way you'd expect in any scripting language.
There are no inputs. The single output is list (IMAGE, list type), initially empty. That's the entire contract.
Where you'd use it
The canonical pattern is a loop or a multi-branch build-up:
- Start with
XJEmptyImageList. - Run
XJAppendImageListper iteration (or per branch), threading the growing list back around. - Finish with a slice, a length check, or a save.
The same pack's loop nodes are explicitly documented to preserve lists as-is through iterations - no auto-expansion into batches - which is exactly the behavior this pattern depends on.
Installing it
Part of ComfyUI-XJNodes:
cd ComfyUI/custom_nodes
git clone https://github.com/alexjx/ComfyUI-XJNodes
then restart ComfyUI (or ComfyUI Manager → ComfyUI-XJNodes). No models, no dependencies.
Common issues
The main trap is feeding this empty list into a node that isn't list-aware. A standard node expecting a plain IMAGE batch will choke on an empty Python list - the pack's list nodes all check isinstance(image_list, list) and raise a clear error precisely to catch this. If you get a "expected list" or type error, look at whether every hop in your chain understands lists. And don't forget the empty-list edge case: slicing or indexing an empty list errors by design, so guard loops with a length check if your list might legitimately end up empty.
Inputs (0)
No inputs
Outputs (1)
| Name | Type | Description |
|---|---|---|
| list | IMAGE | — |