Image Tensor List (Swwan)
How you keep images of different sizes in one wire
- image1
- image2
- IMAGE
The problem it solves
A ComfyUI IMAGE batch is a single stacked tensor, which means every image in it has to be the same size. That's fine until it isn't - a folder of mixed crops, a batch of thumbnails, anything you collected from different sources. Stacking them is a shape error.
The other container in ComfyUI, the list, has no such rule. It's just a Python list of tensors and each entry keeps its own dimensions. Image Tensor List (KJNodes' original, kept in this pack under Swwan/Advanced/Batch) is the node that puts two images into one of those lists.
How it works, including the quirk
Two required inputs, image1 and image2, one output. The clever bit is that the output is declared as IMAGE but what the node actually returns is a list of tensors. That's the KJNodes convention this node faithfully preserves: ComfyUI's type check is satisfied by the declared type, while downstream nodes that understand lists get a real list. If you've ever wondered why a node labelled IMAGE can't be fed to a Batch node, this is why.
It also accepts either side being a list already. Feed a list into image1 and a tensor into image2 and you get the list with the tensor appended, which means you can chain these to build lists longer than two without any multi-input widget nonsense.
The outputs matter downstream: hand the list to Image List to Image Batch in the same pack and you get a stacked batch - but only if everything in the list is the same size, because a batch can't be heterogeneous. Hand it to Get Images From Batch Indexed or Batch Slice and you keep the list semantics. The pack's README is blunt about the failure mode: an empty list cannot be converted, and images of different sizes must be unified first or left as a list.
If you're coming from the KB's framing of the plumbing layer - value nodes, list nodes, switches - this is the list-node slot in that taxonomy. It exists to fight repetition and shape rigidity, not to touch pixels.
Install
cd ComfyUI/custom_nodes
git clone https://github.com/aining2022/ComfyUI_Swwan
cd ComfyUI_Swwan
python -m pip install -r requirements.txt
Restart ComfyUI, hard-refresh the tab, search Swwan. This node is pure torch bookkeeping - no OpenCV, no scipy, no GPU, no models. It's in the Swwan/Advanced/Batch category along with the rest of the batch toolkit (Image Batch Multi, Insert Images To Batch Indexed, Pad Image Batch Interleaved, Replace Images In Batch, Reverse Image Batch - all suffixed (Swwan) in the menu), which is the folder to bookmark if you do a lot of batch assembly.
Common issues
A downstream node rejects the list. Lists are second-class citizens in ComfyUI - plenty of IMAGE-typed inputs assume a stacked tensor and will either error or silently misbehave on a list. Convert with Image List to Image Batch first (after unifying sizes), or keep the list inside nodes that advertise list support.
"Cannot convert empty list". You're feeding a list that never had anything appended - usually because an upstream loader returned nothing. Check the folder path or the file glob before blaming this node.
Sizes differ and the batch fails. That's the batch, not the list. Either pad/resize everything to a common size first, or accept that the data has to stay a list and route it through nodes that don't stack.
Missing node after importing an old KJNodes workflow. The node kept its data contract but not its ID - the pack renames KJNodes overlaps to Swwan-prefixed IDs and deliberately registers no conflict aliases. Run the bundled migration:
python scripts/migrate_workflow.py old.json --dry-run
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| image1 | IMAGE | — | |
| image2 | IMAGE | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| IMAGE | IMAGE | — |