ComfyUI Node

Checkpoint to Filename

Put the model's name in the filename, not just the metadata

By trunksn1·Created 10 months ago·Updated 3 months ago· 1
Checkpoint to Filename
    • filename_prefix
    checkpoint_namecheckpoint
    prefixComfyUI
    include_pathfalse

    When metadata isn't enough

    PNG metadata is great until you're skimming a folder of 500 images in a file browser that doesn't show it. CheckpointFilename - shown as Checkpoint to Filename - is the belt-and-suspenders solution: it turns the checkpoint_name string from a rotation loader into a filename prefix, so your saved files read ComfyUI_juggernautXL_00001_.png instead of ComfyUI_00001_.png. After a rotated batch, you can tell at a glance which model produced which image, no metadata viewer required.

    It's a tiny node - one string in, one string out - and that's the whole appeal. If you're already using Save Image (with Checkpoint Info) for metadata, this gives you the same information in the filename as well. I'd use both; metadata is for the machines, filenames are for you.

    How it works

    It takes the checkpoint_name output from one of the rotation loaders (the tooltip says exactly that: "Connect from Checkpoint Rotation node"), strips the file extension, and joins it onto your prefix. By default it keeps only the basename, so sdxl/anime/pony_v6.safetensors becomes ComfyUI_pony_v6. It also scrubs characters that break filenames on Windows (< > : " | ? *), which is a thoughtful touch.

    The three inputs:

    • checkpoint_name - wire it from a rotation loader's output. The tooltip's instruction is the authoritative one.
    • prefix - default ComfyUI. Change it to something meaningful like batch3 if you want grouping.
    • include_path - off by default. Flip it on and the subfolder path is folded into the name too (sdxl_anime_pony_v6), at the cost of longer filenames. Only turn this on if you actually have the same model name in two subfolders and need to tell them apart.

    The output is a single filename_prefix string, which you feed into Save Image (or this pack's Save Image (with Checkpoint Info)) via its filename_prefix input. Because IS_CHANGED keys off the checkpoint name, it re-runs whenever the rotation loader switches models - so the prefix updates per checkpoint on its own.

    Gotchas

    The obvious one: if you leave checkpoint_name disconnected, the default "checkpoint" flows through and every file gets ComfyUI_checkpoint. You'll think the node is broken; it's just doing exactly what you fed it. Also remember the shared constraint of this pack - the loader must actually re-execute per image for filenames to rotate with the models, which means the usual batch_size: 1 + loop setup.

    Install

    Same pack install as everything else:

    cd ComfyUI/custom_nodes/
    git clone https://github.com/trunksn1/comfyui-change-checkpoint-randomly
    

    Restart, check for the Checkpoint Rotation Node loaded successfully! console line. No pip dependencies, no downloads. Find it under Add Node → utils → Checkpoint to Filename, next to the counter helpers it ships alongside.

    Categoryutils

    Inputs (3)

    NameTypeDefaultDescription
    checkpoint_nameSTRINGcheckpointConnect from Checkpoint Rotation node
    prefixSTRINGComfyUIPrefix for filename
    include_pathBOOLEANfalseInclude subfolder path in filename

    Outputs (1)

    NameTypeDescription
    filename_prefixSTRING