Nodes/Canvas/Canvas Cache Updater
ComfyUI Node

Canvas Cache Updater

This node has no outputs, and that's the point

By leocbehe·Created about a year ago·Updated about a year ago· 0
Canvas Cache Updater
  • cache_image
    caching_enabledtrue

    Most nodes do something you can see. Canvas Cache Updater, from the small leocbehe/canvas pack, does the opposite: it has zero outputs and is the pack's memory. It's the node that makes "incrementally build a huge image across many runs" possible, because it's what saves each finished piece somewhere the Canvas Loader can find it next time.

    What it does

    Wire any IMAGE into cache_image - typically the output of your Save Image or Preview node, or the merged canvas from Canvas Merger. Flip caching_enabled off and it's a no-op; leave it on (the default) and it writes that image into the pack's cache as prev_generated_image_1.png, then shuffles the older cached images down: the previous _1 becomes _2, _2 becomes _3, and so on, with _5 deleted. A rolling five-deep history of your last generations, kept on disk in custom_nodes/canvas/cache/.

    The loader's update_canvas toggle reads prev_generated_image_1.png - the most recent one - and promotes it to be your new canvas. So the loop reads: generate a piece this run → CacheUpdater stores it → next run, flip update_canvas on the loader and your freshly generated image is the canvas you build on. The promotion is one run behind by design: the cache you read was written by the previous run.

    The gotchas

    • Batch size must be 1. The node explicitly raises ValueError("Batch size greater than 1 is not supported") if you hand it a batch. If your sampler produces a batch, split it before this node or it hard-fails your run.
    • It's an output node, so it always executes. That's intended - it's the designated sink that captures the generation.
    • It's a file write, not a model operation. No VAE, no sampling, no GPU. Just PIL converting your tensor to a PNG. If you're wondering why it's so fast, that's why.

    When you need it

    If you're using the pack's loop at all - Loader → Selector → sample → Canvas Merger - you want this node in the graph, wired to whatever represents "the piece I just finished." Without it, update_canvas on the loader has nothing to promote and your canvas never advances. If you're only using the pack for a one-shot crop-and-stitch and don't care about persistence, you can skip it entirely and lose nothing.

    Installing

    Same pack as the rest of Canvas. ComfyUI Manager → search "Canvas", or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/leocbehe/canvas
    

    Restart ComfyUI. No extra dependencies, no model files, no API keys - it only uses what ComfyUI already bundles. As with the rest of this pack, it's a brand-new personal project (version 0.0.1, GPL-3.0), so expect rough edges and report them to the author rather than assuming you're doing it wrong.

    CategoryCanvasNodes

    Inputs (2)

    NameTypeDefaultDescription
    cache_imageIMAGE
    caching_enabledBOOLEANtrue

    Outputs (0)

    No outputs