Nodes/🗂️ Dict Tools/🗂️Dict → Image🔵
ComfyUI Node

🗂️Dict → Image🔵

Pull images out of the bus when you need them

By Lex-DRL·Created 4 months ago·Updated 4 months ago· 1
🗂️Dict → Image🔵
  • dict
  • value
◄key—►
â—„cleanup_keytrueâ–ş

Images are the currency of ComfyUI - everything eventually becomes one, and plenty of workflows route them around: from the VAE decode to the preview, into an img2img pass, into a ControlNet preprocessor, into a save node. DictExtractImage ("🗂️Dict → Image🔵") is how an image travels inside the dict bus and gets pulled back out at the consumer, instead of crossing the graph as one more loose blue wire.

If you've stored an image with DictAddImage up top, this is the return trip. The bus pattern shines with multi-stage pipelines: the first pass's output image, the masked composite, the upscaled result - each can be a keyed slot in the dict, and each consumer (VAE Encode for img2img, Save Image, a detailer's source) extracts exactly the image it needs. You end up with one place that says "these are the images in play," rather than a map of blue wires you have to trace by eye.

What you set

  • dict (required) - the dictionary to read from (non-empty).
  • key - the slot where the image lives.
  • cleanup_key (on by default) - normalizes the key.

Output: value as IMAGE, wired into preview, encode, save, or any image-consuming node.

Why images work so well in a dict

Two practical reasons. First, an IMAGE in ComfyUI is a batch (a tensor with a batch dimension), and images you want to share - like a reference for several passes - are exactly the kind of thing you don't want to load or decode repeatedly. Second, the dicts here are immutable frozendicts, so handing the same image wire to a preview and an img2img pass simultaneously is safe; neither can clobber the shared data. That combination - a single source of truth that's safe to fan out - is the whole point.

The extractor type-checks what it returns, so storing something that isn't an image under the key raises a clear error instead of a downstream mess. And per pack rules, a missing key errors loudly with "No such key in Dict" rather than silently returning nothing.

Install

Same for the whole pack - small, one lightweight dependency (frozendict), no model downloads. ComfyUI Manager: search "Dict Tools". Or:

cd ComfyUI/custom_nodes
git clone https://github.com/Lex-DRL/ComfyUI-DictTools

Restart ComfyUI. Needs 0.18.0+ (newer extension API) - if the nodes don't appear after install, update ComfyUI first. There's no built-in dict inspector in the pack, so to confirm which image a slot holds, extract it and attach a preview - that's the intended workflow anyway.

Category🗂️ Dict Tools/Extract

Inputs (3)

NameTypeDefaultDescription
dictDICTA Dictionary to work with.
keySTRINGKey (name) of the item extracted from the dict.
cleanup_keyBOOLEANtrueAutomatically remove leading/trailing spaces and extra newlines from the key.

Outputs (1)

NameTypeDescription
valueIMAGEThe actual Image-type item extracted from the Dict.