Nodes/Canvas/Canvas Loader
ComfyUI Node

Canvas Loader

The Canvas Loader

By leocbehe·Created about a year ago·Updated about a year ago· 0
Canvas Loader
    • canvas_image
    use_canvasfalse
    update_canvasfalse
    image_width1024
    image_height1024
    fill_img_withwhite

    If you want to build one enormous image piece by piece - an endless outpainting, a character sheet, a street you keep extending - the first thing you need is either a blank slab of pixels at the right size or a way to pick the slab back up mid-project. That's the entire job of Canvas Loader, the entry point of the small leocbehe/canvas pack. Everything else in the pack hangs off this node's single canvas_image output.

    What it actually does

    Two toggles and a size decide everything. With use_canvas off (the default), it builds a fresh blank canvas - image_width and image_height from 128 to 4096 in steps of 64, filled with white, black, or random noise via fill_img_with. White is the sane default for outpainting prep: you mask the empty area and let the model invent what goes there. Random gives you a noise slab, which is handy if you'd rather hand the sampler a head start than a solid color.

    Flip use_canvas on and it loads the pack's saved canvas.png from its cache instead. Flip update_canvas on and it first promotes the most recently generated image into canvas.png, then loads that. So the incremental loop is: generate a piece, save it with the pack's cache updater, and next run tell the loader "make this my new canvas." That's the whole persistence trick - the canvas survives between runs because it lives as a PNG file, not just in RAM.

    How the wiring stays fresh

    The loader implements IS_CHANGED by hashing canvas.png. Every time that file changes, ComfyUI treats the node as dirty and re-executes everything downstream of it. That's what makes a workflow where you tweak one margin and the whole chain re-runs feel responsive rather than frozen. It also prints a debug line to your console on every execution, which is noise, not an error.

    Where the cache lives

    The pack writes to ./custom_nodes/canvas/cache/ relative to ComfyUI's working directory - normally that's ComfyUI/custom_nodes/canvas/cache/. Keep it in mind when you can't find your canvas: it's not in your output folder, it's a working file next to the node code. There are no model downloads, no API keys, and no dependencies beyond the torch, torchvision, and PIL that ship with ComfyUI already. This is a genuinely lean little pack.

    Installing it

    ComfyUI Manager is the easy route: search "Canvas" and install. Manually:

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

    Restart ComfyUI and the five Canvas nodes appear under the CanvasNodes category. It's by Leo Behe, GPL-3.0, version 0.0.1, and as of this writing has essentially zero community footprint - you're an early adopter, which means you're also the QA team. If a run does something weird, it's a brand-new personal project, not a battle-tested one.

    When to reach for it

    Honestly? Only if you're committing to the pack's loop (Loader → Selector → sample → Merger). As a standalone "make a blank image" node, core ComfyUI does that trivially. Its value is the persistence and the update plumbing. If your workflow is "generate a whole 4k image at once," this node is overkill. If your workflow is "build this image in pieces across many runs," it's the foundation.

    CategoryCanvasNodes

    Inputs (5)

    NameTypeDefaultDescription
    use_canvasBOOLEANfalseUse an existing image as a canvas.
    update_canvasBOOLEANfalseReplace the current canvas with the most recently generated image.
    image_widthINT1024128–4096
    image_heightINT1024128–4096
    fill_img_withCOMBOwhite3 options: white, black, random

    Outputs (1)

    NameTypeDescription
    canvas_imageIMAGE