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

Add to Image Dict

Collapse a pile of image wires into one

By TinyBeeman·Created about a year ago·Updated 16 days ago· 1
Add to Image Dict
  • image_dict
  • image
  • ImageDict
◄key►

What it's for

Some workflows produce a set of images rather than one: the same subject from four angles, a base plus a masked re-render plus its mask preview, a checkpoint comparison. Normally that's four wires crossing the canvas and four save nodes.

Add to Image Dict is the pack's answer. It builds an ImageDict - a plain Python dictionary of key → image - and carries the whole set down one wire. It's the same bundling idea as rgthree's Context or Easy-Use's pipe (see the plumbing doc), just narrowed to one job: images with names.

How it works, and the trick in it

Each node takes a key, an optional incoming image_dict, and an optional image:

  • image wired → image_dict[key] = image, and it prints [Image Dict] action=add key=... size=... to the console.
  • image left unwired → it removes that key from the dict.

So one node type is both the write and the erase, and the console line is your only feedback that either happened. Chain them and you build the dict incrementally; the first one in the chain is the one you leave image_dict unwired on, every later one takes the previous node's output.

The dict object isn't copied. The node mutates the dictionary you passed in and returns the same reference, which is efficient and also means a dict branched to two places shows the later writes in both - the classic "stale shared object" smell. If a downstream read surprises you, that's usually why.

Keys double as filenames when you eventually save the dict, so keep them boring. The save node strips anything outside -_.(), letters and digits, replaces spaces with underscores, and appends .png. face and pose_side survive intact; my/face ref becomes my_face_ref.png.

One more note: keys keep insertion order. That order is what Image Dict to List hands back, so the sequence in which you chain these nodes decides which image is index 0 later.

Inputs and outputs that matter

key is the only required input (a STRING widget you type into). image_dict and image are both optional, both forced inputs. The single output is ImageDict, which wires into Save Image Dict To Zip, Image Dict to List, or the read side, Get from Image Dict.

Installing it

Part of ComfyUI-TinyBee, under the 🐝TinyBee/Dicts category. Nothing to download - the README lists all dependencies as standard library, and requirements.txt is just pillow.

Manager: search ComfyUI-TinyBee. Or by hand:

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

Restart, then search "Add to Image Dict" in the Add Node menu.

Worth knowing: the source marks the Dict and List nodes in this pack as migrated from ComfyUI-Nid, and they kept the old node names deliberately so existing workflows still resolve. If you also have ComfyUI-Nid installed, you now have two packs registering the same node names - remove one.

Where people get burned

The delete-on-empty behavior is the one that bites. You wire three images into three chained nodes, then unplug one image to compare outputs, and that key silently disappears from the dict - the node prints action=remove and moves on. Downstream, Get from Image Dict returns None for the missing key, and the error surfaces several nodes later as an unhelpful NoneType complaint. When something downstream explodes for no visible reason, check whether an image wire came loose.

Repeating a key is fine but lossy: the second write just overwrites the first.

Finally, these dict nodes declare IS_CHANGED as float("NaN"), which forces them to re-run on every queue. That's deliberate - a dict being assembled across several nodes in one graph execution has to actually execute - but it does defeat ComfyUI's cache for everything behind it, so don't stack them into a graph you're trying to keep snappy.

Category🐝TinyBee/Dicts

Inputs (3)

NameTypeDefaultDescription
keySTRING—
image_dictoptImageDict—
imageoptIMAGE—

Outputs (1)

NameTypeDescription
ImageDictImageDict—