Nodes/comfyui_io_helpers/ImageSaveToPath(IOHelpers)
ComfyUI Node

ImageSaveToPath(IOHelpers)

Save images to any folder you want — with one catch

By Ryuukeisyou·Created 2 years ago·Updated 2 years ago· 2
ImageSaveToPath(IOHelpers)
  • images
    folder_path
    filename_prefixComfyUI
    save_prompttrue
    save_extra_pnginfotrue
    compress_level4

    Core Save Image writes into ComfyUI/output/ and organizes files by date. That's fine for personal use and a mild headache the moment your workflow needs files somewhere specific - a per-project folder, a network share, a directory a watcher script is polling. ImageSaveToPath(IOHelpers) gives you the two things Save Image won't: a folder_path and a filename_prefix you actually control.

    For automation this is the save node you want, because it also tells you where things landed. The UI and API results include each file's filename, folder, and full path, so a script wrapping ComfyUI knows exactly what to pick up next.

    How it works

    The node scans the target folder for existing PNGs, then writes each image as {filename_prefix}_{00000}.png (zero-padded five digits), incrementing the counter across the batch. Like core Save Image, it embeds the workflow's prompt and extra PNG info as PNG metadata unless you turn those off, and compress_level (0–9, default 4) trades file size against write speed and CPU.

    The inputs that matter

    • images - the IMAGE to save.
    • folder_path - where to write. This is the whole point: any folder the ComfyUI process can write to.
    • filename_prefix - base name (default "ComfyUI"), becomes {prefix}_00000.png.
    • save_prompt / save_extra_pnginfo - embed workflow metadata (both default on).
    • compress_level - PNG compression, 0–9.

    Installing it

    Same story as every node in this pack: a single dependency-free file from GitHub user Ryuukeisyou, no requirements.txt, no model downloads. Manager → search "comfyui_io_helpers" → install → restart, or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/Ryuukeisyou/comfyui_io_helpers
    

    Restart ComfyUI; nodes appear under "io_helpers".

    Common issues - read this before you rely on it

    • The catch: a real bug in the shipped code. The widget is named filename_prefix, but the function's parameter is called file_name. ComfyUI calls node functions with keyword arguments matching the input names, so this mismatch can throw a TypeError: main() got an unexpected keyword argument 'filename_prefix' the instant the node runs. If you see that, it's the pack, not your workflow. Two ways out: patch nodes.py so the parameter name matches the widget (rename file_name to filename_prefix in the function signature), or fall back to core Save Image / the pack's ImageSaveAsBase64.
    • The folder must exist. os.scandir on a nonexistent path raises - the node won't create directories for you.
    • Collision checking is shallow. It snapshots the folder once before saving and only checks once per file, so it's not a real overwrite guard. Don't point two runs at the same folder with the same prefix at the same time.
    • Metadata: if you're saving hundreds of files, leaving both metadata booleans on bakes a full workflow copy into every PNG.

    Once you know about the parameter-name bug, this node's the one for path-controlled output. Just verify your pack version handles it before you build a pipeline around it.

    Categoryio_helpers

    Inputs (6)

    NameTypeDefaultDescription
    imagesIMAGE
    folder_pathSTRING
    filename_prefixSTRINGComfyUI
    save_promptBOOLEANtrue
    save_extra_pnginfoBOOLEANtrue
    compress_levelINT40–9

    Outputs (0)

    No outputs