ComfyUI Node

Save CivitAI

Want CivitAI to actually read your ComfyUI PNGs? This node writes A1111-style metadata

By ThomasBaudou·Created 2 years ago·Updated 2 years ago· 1
Save CivitAI
  • images
    filename_prefixComfyUI
    lora_stackerLoRA Stacker
    efficient_loaderEfficient Loader
    samplerKSampler

    Save CivitAI is a drop-in replacement for the core Save Image node with one extra job: it stamps your PNGs with the A1111-style generation string, the "parameters" text chunk that CivitAI's upload tooling reads to auto-fill model hashes, prompts, and LoRAs. ComfyUI's built-in saver embeds the workflow JSON so you can drag the image back into ComfyUI, but it writes nothing CivitAI can parse into a nice model card. For most of the SD 1.5/SDXL era, showcase metadata on CivitAI came from A1111, so if you've ever uploaded a ComfyUI generation and watched the site shrug at the prompt box, this node is aimed squarely at you.

    It's a tiny personal project - single commit, a three-line README, and it even ships in a menu folder literally called "MyTest." Don't let that scare you off: the mechanism is simple and it does the one thing core ComfyUI refuses to.

    How it works

    The node reads the graph's PROMPT data and matches it against the three string inputs you give it. For each save it scans every node's class_type, finds the ones containing Efficient Loader, LoRA Stacker, and KSampler, then pulls prompts, steps, CFG, seed, model, VAE, and LoRA info out of their inputs. Then the clever part: it hashes the actual model files - SHA-256 of the checkpoint, VAE, and each LoRA, truncated to 10 hex chars, which is exactly the A1111 model-hash convention - and writes them into the parameters chunk. Real hashes, not placeholder text, which is what makes CivitAI's auto-detection work.

    It also saves like A1111: into a dated YYYY-MM-DD/ subfolder under your output directory, filename prefix_00001_.png. The workflow JSON and any extra_pnginfo still get embedded as usual, so you don't lose the drag-back-into-ComfyUI behavior. One nice touch: in a batch, hashes are computed once on the first image and copied to the rest, with only the seed re-read per image.

    Inputs that matter

    • images - your batch, straight from the VAE decode.
    • filename_prefix - default ComfyUI; becomes the dated subfolder + filename base.
    • lora_stacker, efficient_loader, sampler - the three node names to hunt for in the graph. Defaults match the efficiency-nodes pack this is built on.

    It has no output sockets; it's an end node, and the images land in ComfyUI's normal image browser.

    Install

    cd ComfyUI/custom_nodes
    git clone https://github.com/Wakfull33/ComfyUI-SaveImageCivitAI
    # it's built on efficiency nodes, so grab those too:
    git clone https://github.com/jags111/efficiency-nodes-comfyui
    

    Restart ComfyUI. No requirements.txt and no extra Python deps - everything it imports (PIL, numpy, yaml, safetensors) already ships with ComfyUI core. ComfyUI Manager may not have this one in its registry given how obscure it is; cloning is the reliable route.

    Where people get burned

    The big one is speed. Hashing a 7 GB checkpoint by reading the whole file takes a real moment on every save - a few seconds on NVMe, an eternity on a spinning disk, and it re-hashes every LoRA too. The batch optimization only covers images 2+ within one batch; each new generation pays the cost again.

    Second, the name matching is a silent substring search. Use a different loader or sampler than the defaults and the node finds nothing, and instead of erroring it just writes a nearly empty parameters chunk. Same if you rename nodes. Check the PNG's metadata in a reader after your first save, because nothing will warn you.

    Finally, the parameters line is close-but-not-A1111: it reads sampler_name and scheduler but never writes them, and the code prints "Clip slip" instead of "Clip skip" (that typo is in the source, not a typo on my part). Most CivitAI parsers care about model hash, prompt, and LoRA hashes, which it nails - but if you need byte-perfect A1111 output, this isn't it. For everyone who just wants their uploads to stop coming out blank, it does exactly what it says.

    CategoryMyTest

    Inputs (5)

    NameTypeDefaultDescription
    imagesIMAGE
    filename_prefixSTRINGComfyUI
    lora_stackerSTRINGLoRA Stacker
    efficient_loaderSTRINGEfficient Loader
    samplerSTRINGKSampler

    Outputs (0)

    No outputs