Nodes/barakapa-nodes/Save Image (Custom)
ComfyUI Node

Save Image (Custom)

Real filenames and subfolders, not ComfyUI_00001_.png forever

By barakapa·Created about a year ago·Updated about a year ago· 0
Save Image (Custom)
  • images
    directory_name
    file_name_prefixComfyUI_
    is_counter_enabledtrue
    file_name_suffix_
    compress_level4

    The save node for people who actually organize output

    ComfyUI's stock Save Image is fine until it isn't. You run forty generations and output/ turns into a flat pile of ComfyUI_00001_.png through ComfyUI_00040_.png, with no idea which run any of them belongs to. brkp_SaveImage is the pack's answer: the same save behavior, but with a subdirectory, a real naming scheme, and a counter you control.

    It's a quality-of-life node, not a magical one - if you're the "dump everything in output and sort it later" type, you don't need it. If you archive by run or by model, you'll wonder why you ever lived without it.

    How it works

    Under the hood it's the standard save path: it takes your IMAGE tensor, converts it to PNG, and writes it with the workflow and prompt embedded as metadata chunks - exactly the "the image is the project file" behavior ComfyUI always has. The --disable-metadata flag still works, and everything else about the metadata story is unchanged.

    What's different is the naming. For each image in the batch it builds a filename from pieces:

    • file_name_prefix (default ComfyUI_) - what goes at the front.
    • A five-digit counter if is_counter_enabled is on (default true). The counter is derived by counting existing .png files in the target subdirectory, then bumped per image in the batch.
    • file_name_suffix (default _) - whatever you want after the number.

    So with defaults you get ComfyUI_00042_.png, matching core's look. Flip the counter off and the name is just prefix + suffix. There's also a %batch_num% tag you can drop in either prefix or suffix - it becomes the per-image index within a batch, which is how you tell apart the 4 images of one batch run.

    A couple of details from the source worth knowing:

    • It never overwrites an existing file - if the computed name is taken it appends _1, _2, and so on, which beats core's behavior of just plowing onward.
    • directory_name is a subfolder of output/, and it (plus prefix and suffix) supports the pack's search-and-replace tags - %date:yyyy-MM-dd% for the date, or %SomeNode.widget% to pull a live value from another node. Bake the seed or resolution into the name if you want.
    • compress_level (default 4) is the PNG compression level, 0–9. Higher means smaller files and slower saves; 4 is a sensible middle.

    Inputs that matter

    images (your output tensor), directory_name (subfolder of output - the one beginners should actually set), and file_name_prefix. The rest you can leave at defaults until you need them. It's an output node, so it has no outputs - it's the end of the line.

    The CivitAI caveat

    This node writes the standard ComfyUI prompt and workflow metadata chunks, same as core - which means it does not write the flat A1111-style parameters string with resource hashes that CivitAI's uploader keys on for auto-linking models and LoRAs. If you post to CivitAI and want that auto-linking, you want one of the dedicated metadata-saver packs, not this node. For keeping your own master PNGs, this is perfectly good - and keep that original PNG, because the workflow in it is the reproducible copy.

    Installing it

    Part of barakapa-nodes. ComfyUI Manager → search barakapa → install → restart, or:

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

    Then restart ComfyUI. No model downloads, no dependencies beyond what ComfyUI already has.

    Categorycustom/Save

    Inputs (6)

    NameTypeDefaultDescription
    imagesIMAGE
    directory_nameSTRINGSub-directory of the output directory to save images to.
    file_name_prefixSTRINGComfyUI_Prefix to be added before the file name.
    is_counter_enabledCOMBOtrueIf enabled, counts the number of files in the specified sub-directory and uses it in the file name. Otherwise, the file name will just consist of the prefix and the suffix.
    file_name_suffixSTRING_Suffix to be added after the file name.
    compress_levelINT4Compression level to be used for saved images.

    Outputs (0)

    No outputs