Nodes/ComfyUI LoadImageWithFilename/Save Image With Filename
ComfyUI Node

Save Image With Filename

Save your images out under the names you actually want

By thalismind·Created about a year ago·Updated about a year ago· 8
Save Image With Filename
  • images
    filenames
    filename_prefixComfyUI

    The stock ComfyUI Save Image node names your output for you: a prefix, then an auto-incrementing counter. Fine for one-off generations, useless the moment you care about which input produced which output - batch upscales, dataset processing, anything where the filename itself is information you want to keep. SaveImageWithFilename is the fix: give it names, and it uses them.

    What it actually does

    It's the same job as core Save Image - write your images to the ComfyUI output directory - with one extra input for control over the name. You can pass it a single filename, or a comma-separated list for a batch. If you give it fewer names than images, the extras just fall back to the normal default-naming behavior rather than erroring out. Whatever name you give it, the node strips any extension you included and replaces it with .png - you don't need to think about the extension at all, just the name.

    The obvious pairing, and honestly the reason this pack exists as a set rather than one isolated node: load images with LoadImageWithFilename or LoadImageFolder from this same pack, do whatever processing you need, then feed the filename/filenames output straight into this node's filenames input. Same names in, same names out - round-trip a folder of files through a workflow without ComfyUI's counter-suffix scheme scrambling which output belongs to which input.

    The inputs that matter

    • images (IMAGE, required) - the images to save. Standard batch tensor.
    • filenames (STRING, default empty) - a single name, or a comma-separated list matching your batch. Leave it empty and this node behaves exactly like default Save Image.
    • filename_prefix (STRING, default "ComfyUI") - only used as a fallback for images that don't get an explicit name. Worth knowing it supports the same formatting tokens as core ComfyUI's prefix field - things like %date:yyyy-MM-dd% or pulling a value off another node, e.g. %Empty Latent Image.width% - so your fallback names can still be structured even when you're not supplying explicit filenames.

    There's no output - this is a terminal node (is_output_node: true), same as the stock Save Image. Its whole job is the write to disk.

    Installing it

    • ComfyUI Manager - search ComfyUI LoadImageWithFilename, install, restart.
    • Manual - cd ComfyUI/custom_nodes && git clone https://github.com/thalismind/ComfyUI-LoadImageWithFilename, restart ComfyUI.

    It's one file (nodes.py), no separate installer, no model downloads - just PIL, PyTorch and NumPy, which you already have running ComfyUI at all. After restart it's under the image category alongside its siblings.

    Common issues

    Comma-separated parsing is literal. If a filename you're passing in genuinely contains a comma, it'll get split apart wrong. Not a likely scenario for auto-generated names, but worth knowing if you're piping in arbitrary user-supplied strings.

    Mismatched counts silently fall back, they don't error. Give it 3 filenames for a batch of 5 images and the first 3 get your names, the last 2 get the default filename_prefix naming. That's a deliberate design choice per the README, not a bug - but it means a typo that drops a name from your comma list won't throw a loud error, it'll just quietly rename one image differently than you expected. Worth a visual check on batch runs until you trust your upstream node is producing the right count.

    Extensions get overwritten, always. If you pass in photo.jpg as a filename, it saves as photo.png - the node always writes PNG regardless of what extension you hand it. Don't expect it to save JPEGs or WebP just because you asked nicely in the filename string.

    Categoryimage

    Inputs (3)

    NameTypeDefaultDescription
    imagesIMAGEThe images to save.
    filenamesSTRINGSingle filename or comma-separated list of filenames. If empty, will use default naming.
    filename_prefixSTRINGComfyUIThe prefix for the file to save. This may include formatting information such as %date:yyyy-MM-dd% or %Empty Latent Image.width% to include values from nodes.

    Outputs (0)

    No outputs