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

🔵Image → Dict🗂️

Images In, One Wire Out

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

If you're stitching together an img2img pipeline, a reference-image pass, or a multi-stage workflow, images are usually the thing that gets dragged all over the canvas. DictAddImage tucks one into your dict under a named key, so the source image, the upscaled result, or the reference photo all travel as part of a single connection.

It's the media-type Add node you'll reach for most, since images are the currency of the whole ecosystem. The IMAGE value is a wired input - you connect it from Load Image, a VAE Decode, or wherever your image came from - and it gets type-checked before being stored.

How it works

Standard Dict Tools behavior: validate the value against the IMAGE type, store it under your key, return a new frozendict. Your input dict is never mutated in place, so chaining a bunch of Add nodes - image here, mask there, latent somewhere else - is safe and each hands you a fresh updated dict. Keys are sorted alphabetically on every update.

The pattern that makes this worth it: collect your input image and your settings dict at the top of the graph, pass the whole thing to a reusable sub-graph, and use DictExtractImage at the point where you actually need the pixels. Your bus carries both the instructions and the raw material.

The inputs that matter

  • key (STRING) - the name you'll fetch the image back by.
  • cleanup_key (BOOL, default on) - trims stray spaces/newlines from the key.
  • dict (DICT, optional) - an existing dict to extend, or empty to start one.
  • value (IMAGE, optional) - the wired image tensor from your loader or decoder.

Output is dict (DICT).

Install

ComfyUI Manager: search Dict Tools, install, restart. Or:

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

Restart ComfyUI after. Only dependency is frozendict, auto-installed by Manager.

Gotchas

Pack-wide rule: the pack is built on ComfyUI's newer node API and needs 0.18.0+. If Manager reports failed to load, update ComfyUI first.

The input being optional is where people trip: leave value unwired and the node silently stores nothing meaningful under that key - you won't notice until DictExtractImage downstream fails or returns nothing. Always double-check you actually connected the image port, not just the dict chain. And if you're storing the output of a VAE Decode, that's the right type; a latent is not, and the type check will tell you.

Category🗂️ Dict Tools/Add

Inputs (4)

NameTypeDefaultDescription
keySTRINGKey (name) of the item inserted into the dict.
cleanup_keyBOOLEANtrueAutomatically remove leading/trailing spaces and extra newlines from the key.
dictoptDICTAn (optional) Dictionary to work with.
valueoptIMAGEThe actual Image-type item to add into the Dict.

Outputs (1)

NameTypeDescription
dictDICT—