Nodes/ComfyUI-Batch-Process/Image Batch Saver
ComfyUI Node

Image Batch Saver

Save images with matching .txt captions, or stack frames into a GIF

By Zar4X·Created about a year ago·Updated 4 days ago· 16
Image Batch Saver
  • images
    contents
    output_path
    filename_prefixIMG
    filename_delimiter_
    filename_suffix
    extensionpng
    filename_number_padding4
    filename_numberend
    embeded_workflowtrue
    append_framesfalse
    start_index0
    end_index0

    Image Batch Saver is the write-half of the batch pipeline: it takes images, writes them to disk with a counter-safe filename, and drops a matching .txt file beside each one. If you're assembling a training dataset or just want every generated image to carry its caption as a sidecar file, this is the node that makes it painless. It's an output node with no outputs, and every input is optional.

    Its two best tricks are the companion text files and the append_frames mode, so let's talk about those.

    The companion .txt files

    The contents input is a forceInput string - it wants a wire, typically from this pack's TXT Batch Loader or Text Modify Tool. For every image saved, the node writes <name>.txt next to it containing that text. That's the classic image-text pair layout that LoRA trainers and dataset prep scripts expect: one image, one caption, same basename. The lora-training crowd will recognize why that matters - dataset organization is half the battle when you're captioning by hand or running a tagger.

    append_frames: the memory trick

    append_frames (off by default) appends new frames to an existing file with the same base name instead of creating a new one. The point is memory: rather than hold an entire animation in VRAM and write it in one shot, you can loop, generate a few frames, append them, repeat. The tooltip says it plainly: "Useful for accumulating frames across loop iterations to reduce memory usage." One catch worth knowing: PNG can't hold multiple frames, so if you enable append_frames with a non-animated format, the node auto-converts the output to GIF. If you were expecting a PNG sequence, that's the moment you learn why you got a GIF.

    The inputs that matter

    • images - a batch tensor. Multi-frame tensors get sliced by start_index / end_index (1-based, 0 = all frames) before saving.
    • output_path - empty goes to ComfyUI's default output dir; relative paths land under it.
    • extension - png, jpg, jpeg, webp, bmp, tiff, or gif. Default png.
    • filename_prefix (default IMG), filename_number (off/start/end, default end), filename_number_padding (default 4) - together these build names like IMG_0001.png, with the counter where you want it.
    • embeded_workflow (default on) - embeds the workflow into the PNG metadata, matching the built-in Save Image behavior. PNG is where the metadata goes; don't count on it surviving a JPEG.

    Installing it

    Part of Zar4X/ComfyUI-Batch-Process - Manager search ComfyUI-Batch-Process, or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/Zar4X/ComfyUI-Batch-Process
    

    Restart. Dependencies are Pillow and torch, both already present.

    Troubleshooting

    The node always re-executes on queue runs, so repeated runs write fresh counter numbers rather than overwriting - if files keep appearing with new numbers, that's the counter doing its job, not a leak. If append_frames isn't producing the animation you expect, double-check the extension: you either need to select GIF yourself or accept the auto-conversion. And remember the node is fine running with no images at all - it'll just generate filenames. If you wired it up and see paths but no pictures, check whether images is actually connected.

    CategoryBatch Process

    Inputs (13)

    NameTypeDefaultDescription
    imagesoptIMAGE
    contentsoptSTRING
    output_pathoptSTRING
    filename_prefixoptSTRINGIMG
    filename_delimiteroptSTRING_
    filename_suffixoptSTRING
    extensionoptCOMBOpng7 options: png, jpg, jpeg, webp, bmp, tiff, +1
    filename_number_paddingoptINT41–9
    filename_numberoptCOMBOend3 options: off, start, end
    embeded_workflowoptBOOLEANtrue
    append_framesoptBOOLEANfalseAppend new frames to existing file with same base name. Useful for accumulating frames across loop iterations to reduce memory usage.
    start_indexoptINT00–999999Start index (1-based) for frames to save. Use 0 to save all frames, or set 1 for first frame, 2 for second frame, etc.
    end_indexoptINT00–999999End index (inclusive, 1-based) for frames to save. Use 0 to save all remaining frames, or set >0 to limit range.

    Outputs (0)

    No outputs