Nodes/ComfyUI-TinyBee/Image Dict to List
ComfyUI Node

Image Dict to List

Explode the bundle back into a walkable batch

By TinyBeeman·Created about a year ago·Updated 16 days ago· 1
Image Dict to List
  • image_dict
  • ImageList
  • ImageNames
  • ImageCount

What it's for

The bundling trick (Add to Image Dict) is only worth it if you can get back out again. This node is the exit ramp: it takes an ImageDict and returns the images as a list, their keys as a list of names, and a count.

That converts a labelled set into something you can loop over. A list output in ComfyUI isn't just a container - wire it into a node that isn't declared as a list-input and that node runs once per element. So Image Dict to List is how "four named images on one wire" becomes "run this save node four times, once per image".

How it works

Three lines of Python, essentially: values to one list, keys to another, len() to an int. The one detail that matters is order. Python dicts preserve insertion order, so the lists come back in the order the images were added - that is, the order you chained your Add to Image Dict nodes, not alphabetical and not the order files appear on disk. ImageNames[2] is the name of ImageList[2], index for index, and that pairing is the entire reason the names output exists.

It also re-runs on every queue (IS_CHANGED returns float("NaN"), the standard trick for a node that must see in-flight mutations), and every node downstream of it inherits that - a queue that runs a batch over this list is not going to be cached between runs.

Inputs and outputs

One required input, image_dict. Three outputs:

  • ImageList - the images, in dict order, ready to fan out.
  • ImageNames - the keys, in the same order.
  • ImageCount - how many there are, as an INT. Handy for sanity-checking a filter or an Add chain before you commit to a long batch.

The nice real-world wiring: convert a Save Image node's filename_prefix widget to an input, wire ImageNames into it, and each saved file is named after its key instead of ComfyUI_00042_.png. You get a labelled folder for free.

Installing it

Part of ComfyUI-TinyBee, in the 🐝TinyBee/Dicts category. Nothing to install beyond the pack - its README states every dependency is Python standard library and requirements.txt lists only pillow, so it's one of the rare packs that doesn't participate in the ecosystem's dependency roulette.

cd ComfyUI/custom_nodes
git clone https://github.com/TinyBeeman/ComfyUI-TinyBee

Restart ComfyUI, or just search ComfyUI-TinyBee in Manager. Heads up: these Dict/List nodes were migrated from the author's older ComfyUI-Nid pack and kept the original node names, so installing both packs gives you two nodes with the same name.

Where people get burned

Ordering is the one that catches people out, because nothing warns you. If your keys were added by a chain of nodes and you later reorder that chain, the image at index 2 changes and anything index-based downstream now points at a different picture. The names output is what saves you here: if you're going to index by number, print the names once and confirm the mapping actually matches your mental model.

An empty count means the dict is empty, which almost always traces back upstream to Add to Image Dict nodes being fed nothing - a wired-nowhere image input doesn't add an entry, it removes one. And because every node in this chain is deliberately uncacheable, a big fan-out built this way will re-execute the whole downstream branch each queue. That's correct behavior; it's just not free.

Category🐝TinyBee/Dicts

Inputs (1)

NameTypeDefaultDescription
image_dictImageDict[object Object]—

Outputs (3)

NameTypeDescription
ImageListIMAGE—
ImageNamesSTRING—
ImageCountINT—