Nodes/ComfyUI-Aimidi-nodes/Save Images Pair
ComfyUI Node

Save Images Pair

Save Images Pair writes an image and its caption out as a matched set

By AiMiDi·Created 2 years ago·Updated 2 years ago· 0
Save Images Pair
  • image
    text
    output_path[time(%Y-%m-%d)]
    filename_prefixComfyUI
    filename_delimiter_
    filename_number_padding4
    extension
    quality100
    lossless_webp
    show_previews
    try_copy_to_output
    image_path

    Save Images Pair writes a caption and an image out together as a matched pair - myimage_0001.png plus myimage_0001.txt in the same folder. It's the output-side half of this pack's pair system, and it's really aimed at one job: building or fixing a dataset. You load an image with Load Images Pair Batch, run its caption through the tag nodes to clean it up, then save the result back with this node - same basename, fresh caption, ready for training.

    That round-trip is the whole story. The lora-training knowledge base is blunt that caption quality is one of the highest-leverage dataset factors there is, and this node is a comfortable way to do that scrub without leaving ComfyUI. It also doubles as a general-purpose "save an image plus its prompt" utility, since it can write the text and image together for any graph, not just dataset loops.

    How it works

    The node does two writes with one filename. It first generates a unique basename: your filename_prefix, a filename_delimiter, and an auto-incrementing counter padded to filename_number_padding digits (ComfyUI_0001), scanning the folder so it never overwrites. It writes the text input to a .txt file with that basename, then saves the image with the same basename and the extension you chose.

    Where it writes depends on output_path. Relative paths resolve under ComfyUI's output folder, and the default - [time(%Y-%m-%d)] - expands to a dated subfolder like output/2026-08-16/. The node supports WAS-style tokens in both output_path and filename_prefix ([time], [hostname], and friends), and it'll create directories that don't exist yet. If the folder doesn't exist, it creates it with a console warning.

    One behavior worth knowing: try_copy_to_output with the optional image_path input changes the save from "re-encode this tensor" to "copy the original file byte-for-byte." If you loaded a source image and want it preserved exactly (no re-compression), wire its path in - handy when you're recaptioning an existing dataset and don't want to touch the pixels.

    Inputs that matter

    • text (required): the caption/tags, wired in - typically from a tag chain or from Load Images Pair Batch's text output.
    • image (optional): the IMAGE tensor to save.
    • extension: pick your format from the dropdown - png, jpg/jpeg, webp, gif, tiff, bmp.
    • quality: only actually affects jpg/jpeg, webp, and tiff. PNG ignores it entirely.
    • show_previews: whether the saved image shows up in ComfyUI's result panel.

    It's an output node, so it has no outputs and terminates the branch.

    Installing it

    Same as the rest of the pack: empty README, no requirements.txt, no model downloads, and no extra dependencies beyond what ComfyUI already ships (numpy, torch, PIL). The node's code is adapted from WAS Node Suite, but it doesn't pull WAS's heavy deps along. Install via ComfyUI Manager (search ComfyUI-Aimidi-nodes) or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/AiMiDi/ComfyUI-Aimidi-nodes
    

    Restart ComfyUI and look for the blue ComfyUI Aimidi Nodes: Loaded console message.

    Common issues

    • Image saved but no .txt - the text input was empty. The node still logs "There is no text specified to save!" but saves the image; check the wiring.
    • Files land in an unexpected folder - output_path with a token like [time(%Y-%m-%d)] creates a dated subfolder each day. That's intentional; if you want a flat folder, set it to a fixed path.
    • JPEG quality does nothing - expected. Quality only applies to lossy formats; PNG always optimizes.
    • A copy happened instead of a save - try_copy_to_output defaults to true, so with image_path provided it copies the file. Set it to false to force re-encode from the tensor.
    • The node writes its batch/config state into was_suite_settings.json in the pack folder - normal for this WAS-derived family, not a problem.
    CategoryAimidi Nodes

    Inputs (12)

    NameTypeDefaultDescription
    textSTRING
    output_pathSTRING[time(%Y-%m-%d)]
    filename_prefixSTRINGComfyUI
    filename_delimiterSTRING_
    filename_number_paddingINT41–9
    extensionCOMBO7 options: png, jpg, jpeg, gif, tiff, webp, +1
    qualityINT1001–100
    lossless_webpCOMBO2 options: false, true
    show_previewsCOMBO2 options: true, false
    try_copy_to_outputCOMBO2 options: true, false
    imageoptIMAGE
    image_pathoptSTRING

    Outputs (0)

    No outputs