Caching Image to not Waste
Caching_image saves any result to disk
- original_image
- executor
- original_image
- cached_image
Think about how many nodes in a typical inpainting workflow take your source image and produce another image: the resize, the upscale, the background removal, the IC-Light relight. Every run of the workflow recomputes all of them, even though the inputs never changed. caching_image from the Caching to not Waste pack is the one that remembers. Run the chain once, and every future run returns the saved image instead of redoing the work - and, thanks to lazy evaluation, doesn't even load the models behind it.
This is the node the pack's whole story is built on. The author's use case: a "remove things from a picture and put other things in the same place" inpainting workflow with several image resizes, and the generation time dropped from 40 seconds to 13 once the repeatable image steps were cached. If you only install one node from this pack, this is the one.
How it works
The mechanism is dead simple. The node hashes the pixel data of your source image plus your identification string into a filename, and stores the executor's output as a PNG in ComfyUI/output/caching_to_not_waste. First run: it runs the executor and saves. Later runs: it finds the file, loads it, returns it. Because the executor input is lazy, a cache hit means the entire upstream chain - resize nodes, upscaler models, anything - never executes.
One thing to internalize: the hash is pixel-exact. Change even one pixel of the source image and you get a brand-new cache entry, which is exactly what you want. But it also means the cache is keyed to the specific image, not to "an image of roughly this subject." Crop, rotate, or re-encode the source and you've effectively got a new key.
The inputs that matter
Four required inputs, and honestly only two of them demand attention:
original_image- the source image that defines the cache.executor- the chain whose image output you want cached. Wire whatever heavy pipeline you want to skip into here.identification- a unique name for the cache entry. Default is"image", and since all caching nodes in the pack share one cache folder, leaving two of them at the default means the second silently overwrites the first. Name them.force_recreate- true to ignore the cache and recompute once; flip it back off after.
Outputs: original_image (passthrough) and cached_image - the remembered result, which you wire into whatever consumed the executor's output before.
Installing it
Same as any ComfyUI custom node. In Manager, search Caching to not Waste, or:
cd ComfyUI/custom_nodes
git clone https://github.com/alastor-666-1933/caching_to_not_waste
Restart ComfyUI and you're done. No dependencies to install, no models to fetch - the pack only uses what ComfyUI already bundles. The cache folder appears under ComfyUI/output/caching_to_not_waste after your first run; delete it to clear everything.
Where people get burned
Stale cache after you change an upstream setting (upscale model, denoise, whatever) is the usual complaint. Set force_recreate true, run once, set it back. And the shared cache folder means cache entries are visible to every workflow - same source image plus same identification gives you the same result anywhere, which is the feature, but it's also why a confusingly-named identification will come back to haunt you.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| identification | STRING | image | — |
| original_image | IMAGE | — | |
| executor | IMAGE | — | |
| force_recreate | BOOLEAN | false | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| original_image | IMAGE | — |
| cached_image | IMAGE | — |