Nodes/Comfyui_LG_Tools/🎈LG_SaveImage
ComfyUI Node

🎈LG_SaveImage

Save images where you want, in the format you want

By LAOGOU-666·Created 2 years ago·Updated 7 months ago· 369
🎈LG_SaveImage
  • images
    filename_prefixComfyUI_{timestamp}
    path
    formatpng
    quality95

    ComfyUI's stock Save Image is fine until it isn't. Everything goes to output/, everything is PNG, and the filename is whatever the default prefix says. That's great when you don't care where files land. It's a problem when you're building a project folder, need a JPG for a website, or want filenames that actually mean something.

    LG_SaveImage is the version that gets out of your way: pick a folder (absolute or relative), pick a format (PNG, JPG, WebP), set a quality, and template the filename with real expressions instead of praying the counter lines up.

    How it works

    It uses ComfyUI's own save-path machinery for the dedup counters, then writes each image itself. The filename prefix is where the magic is - it supports six expressions the node substitutes at save time:

    | Expression | What it becomes | |---|---| | {timestamp} | Unix epoch seconds | | {date} | YYYYMMDD | | {time} | HHMMSS | | {datetime} | YYYYMMDD_HHMMSS | | {batch} | batch index, zero-padded | | {counter} | running counter, zero-padded |

    The path field is a real improvement over stock: leave it empty for the default output/ folder, or give a relative path (resolved against the ComfyUI root) or an absolute path - and it auto-creates the directory if it doesn't exist.

    Inputs:

    • images - the IMAGE tensor(s).
    • filename_prefix - template string, default ComfyUI_{timestamp}.
    • path - save location; empty = default output dir.
    • format - png, jpg, or webp.
    • quality - 1–100, default 95, only applies to JPG and WebP. PNG ignores it.

    No outputs; it's a terminal save node.

    Notes worth knowing

    • PNGs are written losslessly at compress level 4; JPGs auto-convert RGBA to RGB (no alpha in JPEG); WebP keeps quality as set.
    • Save a multi-image batch without {batch} or {counter} in the prefix and it appends _00000, _00001… so nothing gets overwritten.
    • The {timestamp} default means the author leans on "never collide" rather than "readable" - switch it to {date}_{counter} if you want files that sort nicely.

    Installing it

    Part of Comfyui_LG_Tools - Manager (search "Comfyui_LG_Tools") or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/LAOGOU-666/Comfyui_LG_Tools.git
    pip install -r requirements.txt
    

    Restart, then right-click → 🎈LAOGOU → Utils.

    Troubleshooting

    • Quality slider does nothing - it's JPG/WebP-only by design. PNG is lossless and ignores it entirely; the tooltip says as much.
    • Files landing somewhere unexpected - relative paths resolve against the ComfyUI root (where you launched it), not against output/. If you wrote render/ and expected it under output/render, that's the mismatch. Use an absolute path if you want certainty.
    • Batch files overwrite each other - only if you use a prefix with no batch/counter expression and ComfyUI's own counter resets; the _00000 suffix path usually saves you, but for multi-batch runs just put {batch} in the prefix.
    • Two nodes with the same prefix - the shared counter machinery dedups by incrementing, same as stock behavior, so you won't clobber across nodes.

    For project-organized output, JPG delivery, or anything where "everything in output/" stops working, this is the unglamorous fix that just does the job.

    Category🎈LAOGOU/Utils

    Inputs (5)

    NameTypeDefaultDescription
    imagesIMAGE
    filename_prefixSTRINGComfyUI_{timestamp}文件名前缀,支持表达式:{timestamp}时间戳、{date}日期、{time}时间、{datetime}日期时间、{batch}批次号、{counter}计数器
    pathSTRING保存路径,支持绝对路径和相对路径,不存在时自动创建
    formatCOMBOpng图像保存格式:PNG无损、JPG/WebP有损压缩
    qualityINT951–100图像质量(1-100),仅对JPG和WebP格式有效,PNG格式忽略此参数

    Outputs (0)

    No outputs