🗂️Dict → Latent🟣
Pass latents around without losing the plot
- dict
- value
Latents are the compressed, pre-decode state of an image - everything a KSampler works in, and the thing you feed into a second pass for img2img or a latent upscale. In a multi-pass workflow the same latent gets threaded through a sampler, an upscale node, another sampler, and eventually a VAE Decode, and that's a lot of purple wires to keep track of. DictExtractLatent ("🗂️Dict → Latent🟣") pulls a latent back out of the dict bus when a consumer needs it.
The classic use is the two-pass pipeline. First sampler produces a latent; you store it in the dict under latent_pass1, run your upscale or refinement, and extract it again for the second sampler or the VAE Decode. The bus makes the flow explicit - one keyed slot per latent state - instead of relying on you to remember which purple wire leads where.
What you set
- dict (required) - the dictionary to read from (non-empty).
- key - the slot name, e.g.
latent_main. - cleanup_key (on by default) - normalizes the key.
Output: value as LATENT, wired into a KSampler's latent input, VAE Decode, or a latent-based upscaler.
Why it works (and one honest caveat)
Latents carry a batch of latent images, and they're the kind of object you want to keep a single authoritative copy of - the immutable frozendict behavior here means the shared latent wire is safe to fan out to a preview and a second sampler at once. That's the organizational win: one keyed latent, clearly labeled, used everywhere.
The caveat: don't confuse "carrying" a latent with "copying" it. A dict holds the same latent object, so if you extract it and send it through a sampler that mutates it in place, your "original" is gone - that's a property of how ComfyUI sampling works, not a bug in this node. In practice the pack's immutability guards the dict, not the contents. Keep that in mind and this node is purely a clarity win.
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. And yes, a missing key raises "No such key in Dict" rather than returning nothing; with latents, silently missing data would be a disaster, so the loudness is your friend.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| dict | DICT | A Dictionary to work with. | |
| key | STRING | Key (name) of the item extracted from the dict. | |
| cleanup_key | BOOLEAN | true | Automatically remove leading/trailing spaces and extra newlines from the key. |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| value | LATENT | The actual Latent-type item extracted from the Dict. |