Nodes/🗂️ Dict Tools/🗂️Dict → int
ComfyUI Node

🗂️Dict → int

Seeds, steps, and sizes, keyed and centralized

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

Integers are the most boring, most essential data in a workflow - the seed, the step count, the width and height, the batch size. They're also scattered across every KSampler and latent node you own, which is why DictExtractInt ("🗂️Dict → int") exists: it pulls integer values out of a settings dict so your numbers live in one place instead of buried in a dozen widgets.

The setup is the dict-bus pattern at its most literal. Top of the graph: DictAddInt nodes with keys like seed, steps, width. Everywhere a KSampler or Empty Latent Image needs one of those values, a DictExtractInt reads it from the bus. Your generation settings become a single readable block - arguably the closest thing ComfyUI has to a config file - and batch-tuning "steps for the whole graph" becomes a one-node edit.

What you set

  • dict (required) - the dictionary to read from (non-empty).
  • key - the slot name, e.g. seed or steps.
  • cleanup_key (on by default) - normalizes the key.

Output: value as an int, wired into any INT input - KSampler steps, seed, Empty Latent width/height, batch count, whatever.

Two things worth knowing

Seeds deserve special mention because they're the most fiddly int in the game. If you're using a "randomize" seed flow, the seed lives upstream of the dict - extract it from the bus and feed it to the sampler, and you keep the whole workflow reproducible off one value. That's the killer use case: a single seed slot that every stochastic node reads from, so you can replay a result by changing one number.

Second, the strictness that keeps this honest: the extractor type-checks on the way out, so a float or a string stored under steps fails with a clear error instead of a sampler trying to divide by a string. Per pack rules, a missing key also raises "No such key in Dict" rather than defaulting - annoying until you realize it's catching your typos.

Install

Same for every node in this 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 show up after install, update ComfyUI before anything else.

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
valueINTThe actual int-type item extracted from the Dict.