Nodes/Image Batch Cacher/Image Batch Cacher
ComfyUI Node

Image Batch Cacher

Stop re-running the expensive half of your workflow

By boobkake22·Created 4 months ago·Updated 5 days ago· 0
Image Batch Cacher
  • signal
  • images
  • depends_on_cache
  • signal
  • images
  • cache_ref
cache_namestage_1
cache_dirimage_cache
modeload_or_save
save_dtypefloat16

ComfyUI is good at not re-running work: within one session it caches node outputs and skips anything whose inputs haven't changed. That cache lives in RAM, and it evaporates the moment you restart, tweak an upstream seed, or swap a model. For a still image that's a few wasted seconds. For an 81-frame Wan clip, a VACE pass, or a chunky upscale, re-doing the whole branch because you wanted a different seed is the kind of waste that makes you close the app and go do something else.

Image Batch Cacher is a lazy cache gate that writes that expensive batch to disk so you only pay for it once. It lands under Flow/Execution, and its own search aliases - "cache video", "wan cache" - tell you exactly who it's aimed at: people running multistage video pipelines where the middle stages cost minutes each.

How it works

The images input is marked lazy, so ComfyUI only evaluates the branch feeding it when the node actually asks. On a cache miss it asks: upstream runs, the result gets saved to disk, and both signal and images pass through. On a hit it returns an ExecutionBlocker for signal (a silent skip - downstream nodes see nothing) and loads the saved images from disk instead of re-evaluating anything.

The part that makes it feel like magic is IS_CHANGED. Rather than always re-running or never re-running, the node returns a fingerprint of the cache file - exists, size, mtime, plus a dependency-staleness check - so ComfyUI re-runs it exactly when the cache is missing, stale, or the mode says refresh. This is the same plumbing the KB's comfyui-node-plumbing.md covers: nodes opt out of ComfyUI's output caching through IS_CHANGED, and this one uses it to keep the cache honest instead of just bypassing it.

Files land at output/image_cache/<cache_name>.images.safetensors - one raw [B, H, W, C] tensor per run, saved through ComfyUI's own save_torch_file. The defaults are sensible: cache_name stage_1, cache_dir image_cache, mode load_or_save, save_dtype float16.

The inputs that matter

  • signal (any): a pass-through token. Blocked on cache hit, passed through on miss.
  • images (lazy IMAGE): the expensive batch. Only evaluated on a miss, or in refresh/save modes.
  • mode: load_or_save (default), refresh (always re-evaluate and overwrite), save_only, load_only (errors out if the cache is missing).
  • save_dtype: float16 (default), float32, uint8.

float16 cuts a video cache in half versus float32, and everything loads back as float32 in the usual 0.0..1.0 image range, so nothing downstream cares what you saved as. uint8 shrinks it further if disk is tight. cache_name and cache_dir can include relative subfolders, but absolute paths and .. are rejected on purpose - the cache stays put.

The outputs are signal, images, and cache_ref, a lightweight reference you feed into a downstream node's depends_on_cache when you're chaining derived caches (say interpolated frames built from sampler frames). If that dependency cache is deleted or regenerated, the derived cache goes stale and gets rebuilt.

Where people get burned

Don't wire the signal output back into the branch that produces images - that's a graph cycle. And don't feed a cache_ref into a gate upstream of the same branch on ComfyUI versions that validate raw links as dependencies; same problem. The node's UI has your back on cleanup: a "Delete This Cache" button when the file exists, plus a refresh button and "Delete All Caches" (which asks first, then removes the deduplicated cache files referenced in the open workflow).

Installing it

No pip dependencies, no model downloads, pure Python over torch/safetensors that ComfyUI already ships. Install via ComfyUI Manager (search "Image Batch Cacher"), or:

cd ComfyUI/custom_nodes
git clone https://github.com/boobkake22/ComfyUI-ImageBatchCacher

Restart ComfyUI and it appears under Flow/Execution. It's a small, focused pack from a regular r/comfyui helper who's been active in Wan workflow threads, and it shows in the quality of the edge-case handling.

The honest take: if you iterate on a multistage video or VACE pipeline - changing seed, tweaking prompt, re-queuing - this is the difference between a five-minute iteration and a thirty-second one. If you queue once and walk away, it doesn't buy you much, but it costs you nothing either.

CategoryFlow/Execution

Inputs (7)

NameTypeDefaultDescription
signal*
imagesIMAGE
cache_nameSTRINGstage_1
cache_dirSTRINGimage_cache
modeCOMBOload_or_save4 options: load_or_save, refresh, save_only, load_only
save_dtypeCOMBOfloat163 options: float16, float32, uint8
depends_on_cacheoptIMAGE_CACHE_REF

Outputs (3)

NameTypeDescription
signal*
imagesIMAGE
cache_refIMAGE_CACHE_REF