ComfyUI Node

SaveImage_Canvas

Save the result and tell the canvas app about it

By taabata·Created 3 years ago·Updated 2 years ago· 259
SaveImage_Canvas
  • images
    filename_prefixComfyUI

    SaveImage_Canvas is a save node with a phone call attached. It does what any SaveImage does - writes your IMAGE tensor to ComfyUI's output folder with PNG metadata - and then it does one more thing: it POSTs the saved file path to the canvas app's server (/getGenStatus) so the interactive canvas knows a new generation landed and can display it. That round-trip is what closes the loop on the pack's canvas workflows: paint → OutpaintCanvasTool pulls state → generate → this saves and notifies → the canvas shows the result.

    It's an output node (no outputs, is_output_node true), so it belongs at the end of the graph.

    How it works

    The save half is ComfyUI boilerplate: folder_paths.get_save_image_path for a numbered filename under your filename_prefix, write each image as PNG with the workflow metadata embedded (unless you launched with metadata disabled). Then the canvas half fires: it builds a small JSON payload {"data": {"flag": true, "genimg": <full saved path>}} and sends it to http://{LISTEN}:{CANVASPORT}/getGenStatus - the same two environment variables (LISTEN, CANVASPORT) that OutpaintCanvasTool reads. The canvas server treats that as "a new image was generated, here's where it lives."

    The inputs that matter

    • images - the IMAGE tensor(s) to save.
    • filename_prefix - prefix for the saved file, default ComfyUI. Files land in ComfyUI/output/<prefix>_<counter>_.png.

    No outputs - it's a terminal node.

    How to install it

    Part of the pack, one install:

    cd ComfyUI/custom_nodes
    git clone https://github.com/taabata/LCM_Inpaint-Outpaint_Comfy
    cd LCM_Inpaint-Outpaint_Comfy
    pip install -r requirements.txt
    

    Or ComfyUI Manager → "LCM_Inpaint_Outpaint_Comfy" → restart. If you actually want the canvas round-trip, you also need the CanvasTool server set up (the README's python setup.py step inside the CanvasTool/ folder) and LISTEN/CANVASPORT exported, because this node crashes if those environment variables aren't set.

    Common issues

    The env-var dependency is the whole story. This node will save your image fine and then throw on the POST if LISTEN or CANVASPORT is unset - the KeyError comes from os.environ[...], and it happens after the save, so it can look like a save failure when the file actually exists. Check your console output, then check your env.

    If you don't care about the canvas app at all - say you grabbed this pack just for the LCM nodes - don't use this node. Use SaveImage_LCM or the built-in SaveImage, which have no server dependency. SaveImage_Canvas exists specifically to talk to the canvas, and it's only worth the setup if you're running the canvas loop.

    Categoryimage

    Inputs (2)

    NameTypeDefaultDescription
    imagesIMAGE
    filename_prefixSTRINGComfyUI

    Outputs (0)

    No outputs