Nodes/ComfyUI-M-Nodes/Save JPG Advanced
ComfyUI Node

Save JPG Advanced

Save JPG without the silent metadata black hole

By oMoStudio·Created 5 months ago·Updated 4 months ago· 1
Save JPG Advanced
  • images
    filename_prefixoMo_Project
    subfolderoMoStudio_Gallery
    quality95
    save_promptfalse
    save_workflowfalse
    group_name_1Main Generation
    positive_1
    negative_1
    seed_1

    ComfyUI's default Save Image node is a PNG machine. If you want JPGs - smaller files, faster uploads, sites that choke on giant PNGs - you've probably hit the wall where a JPG save either crashes on alpha channels or silently drops every scrap of generation info. M_Save_JPG_Advanced, from ComfyUI-M-Nodes, is built to fix both: it saves JPGs that don't crash, and it saves your seeds and prompts as a readable sidecar .txt plus a workflow .json next to the image.

    The one thing to internalize up front: JPGs can't carry ComfyUI's embedded workflow the way PNGs can, so this node's answer is sidecar files, not in-image metadata. Drag a JPG back into ComfyUI and you get nothing. The .json it writes next to the image is your workflow - keep them together.

    How it works

    Feed it an images tensor and it does the usual numpy → Pillow dance, then handles the classic JPG gotcha: if the image is RGBA it flattens it onto a clean white background before saving, because JPEG has no alpha channel and naive converts either crash or leave black halos. Quality is a 1–100 slider, default 95, saved with Pillow's optimize pass.

    Then the interesting part - the metadata, controlled by two toggles:

    • save_prompt writes a .txt beside the image using what the author calls a "hybrid detective" approach. First it dumps anything you've wired in manually as labeled groups (more on those below). Then it silently walks your whole node graph, finds Sampler and CLIPTextEncode nodes, traces their wires backward to recover seeds and prompt text you never connected, and appends them under an "AUTO-EXTRACTED WORKFLOW DATA" header - skipping anything it already captured from your manual wires, so you don't get duplicates.
    • save_workflow dumps the full workflow JSON to a .json sidecar.

    Inputs that matter

    • filename_prefix (default oMo_Project) and subfolder (default oMoStudio_Gallery) - the subfolder routes output into output/<subfolder>/, keeping your main output folder clean. This is the "keep my gallery organized" feature people actually reach for.
    • quality - 1–100, default 95.
    • save_prompt, save_workflow - both off by default. Turn them on or you get plain JPGs with nothing else.

    The optional group inputs are where the manual side lives: group_name_1 ("Main Generation" by default), positive_1, negative_1, and seed_1. The node's + Add Target Trio button spawns more of these groups (up to 20), so you can label and wire several generations' worth of prompt data into one save. This is exactly the pattern the pack's Multi Note feeds into: note → selector → this.

    There are no outputs - it's a terminal output node that registers images in the UI.

    Installing it

    ComfyUI Manager: search "ComfyUI-M-Nodes". Or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/oMoStudio/ComfyUI-M-Nodes
    

    Restart after cloning. No requirements.txt, no model downloads - it only needs what ComfyUI already ships (Pillow, numpy). MIT licensed.

    Where people get burned

    • The detective isn't omniscient. Auto-detection only recovers text from nodes with text/text_g/text_l/prompt inputs, resolves them a few hops deep, and keys off sampler names containing "Sampler". If your workflow uses an exotic conditioning chain, the auto section will be thinner than you hoped - which is exactly why the manual group wires exist. Wire what you care about.
    • No embedded metadata in the JPG. If you post to CivitAI expecting auto model-linking, this node's sidecar files won't do it the way a metadata-writing PNG saver does. For keeping your own records, it's great; for platform auto-detection, look elsewhere.
    • Filename counter weirdness. It uses ComfyUI's standard auto-incrementing prefix, so repeated runs append _00001_, _00002_, etc. into the same subfolder - tidy, but check the subfolder field if images seem to disappear (they're being sorted into oMoStudio_Gallery).

    If your workflow ends in "but I want JPGs and I still want to remember what made them," this is the node for it. Just remember the .txt and .json are half the value - don't delete them on sight.

    CategoryM_nodes

    Inputs (10)

    NameTypeDefaultDescription
    imagesIMAGE
    filename_prefixSTRINGoMo_Project
    subfolderSTRINGoMoStudio_Gallery
    qualityINT951–100
    save_promptBOOLEANfalse
    save_workflowBOOLEANfalse
    group_name_1optSTRINGMain Generation
    positive_1optSTRING
    negative_1optSTRING
    seed_1optINT

    Outputs (0)

    No outputs