Nodes/BrainDead Nodes/BD Cache Image
ComfyUI Node

BD Cache Image

Freeze an expensive image so ComfyUI skips the work on every rerun

By BizaNator·Created 8 months ago·Updated 3 days ago· 15
BD Cache Image
  • image
  • image
  • status
cache_namecached_image
seed0
force_refreshfalse
name_prefix

You know the loop: you tweak one number downstream and the whole graph reruns - including that Qwen edit or ControlNet pass that takes forty seconds and hasn't changed. BD Cache Image is the surgical answer. You drop it after the expensive node, and on every run after the first, ComfyUI skips the upstream entirely and feeds the cached PNG straight through. Not "recomputes then checks" - skips. That's the whole trick, and it's why this node family is the most quietly valuable part of the ComfyUI-BrainDead pack.

The mechanism is ComfyUI's lazy evaluation system. This node's check_lazy_status inspects whether a cache file already exists for your cache_name + seed; if it does, it returns an empty list of needed inputs, which tells the engine "I don't need my upstream at all, don't run it." The image just gets loaded back and passed on. It's the same principle the KB's node-plumbing doc describes for how output nodes walk the graph backward - except here the cache file is the thing standing in for the whole branch.

The inputs that matter

  • image - the IMAGE tensor to cache. Wire in whatever expensive output you want to freeze.
  • cache_name - your label for the cache entry, like character_face_gen or refined_pass. Make it descriptive; you'll see it in the output folder.
  • seed - this is your invalidation handle. The cache filename is hashed from the seed, so change the seed and you get a fresh cache file. That's the recommended way to force a new generation without ripping nodes out.
  • force_refresh - set to True to regenerate and overwrite even though a cache exists. Handy when you know the upstream input changed but want to keep the same seed.
  • name_prefix - optional prefix, so Project1/Step1 turns into a subfolder layout under output/BrainDead_Cache/.

Outputs are image (the tensor, whether loaded or fresh) and status, a string telling you which happened - "Cache HIT" vs "SAVED". Wire the image on to your next node exactly as if the cache node weren't there.

The workflow shape

[expensive node] → [BD Cache Image] → [everything downstream]
                     cache_name: "base"
                     seed: 42

First run generates and saves to output/BrainDead_Cache/. Every run after that loads and skips. Change the seed to 43 when you actually want a new generation. If you have a whole chain of expensive steps (encode → sample → upscale), you can drop a cache node after each and iterate on any segment without paying for the rest.

Installing it

It's one of ~110 nodes in BizaNator/ComfyUI-BrainDead from BrainDeadGuild. Easiest: ComfyUI Manager, search "BrainDead", install - dependencies are auto-installed. Manual route:

cd ComfyUI/custom_nodes
git clone https://github.com/BizaNator/ComfyUI-BrainDead
cd ComfyUI-BrainDead
pip install -r requirements.txt

Restart, and it lives under 🧠BrainDead/Cache. The heavy deps in requirements.txt (MoGe, natten) are only pulled by the Pixal3D nodes, so the cache nodes don't drag anything extra in.

Gotchas

Two things get people. First, the cache is keyed on seed, not on content - if you bump a KSampler seed upstream but forget the cache seed, you'll keep loading the old cached image and swear the workflow is broken. Connect the workflow's seed to the cache's seed if you want auto-invalidation. Second, force_refresh only takes effect when the node actually executes; if you want certainty, flip it on, run once, flip it back off. And clear out output/BrainDead_Cache/ now and then - it fills up fast with hashed copies, and that's what BD Clear Cache exists for.

Category🧠BrainDead/Cache

Inputs (5)

NameTypeDefaultDescription
imageIMAGE
cache_nameSTRINGcached_image
seedINT00–18446744073709550000
force_refreshBOOLEANfalseForce regeneration even if cache exists
name_prefixoptSTRINGPrefix for cache filename

Outputs (2)

NameTypeDescription
imageIMAGE
statusSTRING