Nodes/ComfyUI-GMImageSaver/GM Image JPEG Save
ComfyUI Node

GM Image JPEG Save

A JPEG saver that never touches a PNG file

By ruminar·Created 3 months ago·Updated 8 days ago· 3
GM Image JPEG Save
  • images
    filename_prefiximage
    directory_patternprefix/date
    filename_date_formatnone
    quality80
    subsampling4:2:2
    progressivefalse
    output_dir
    label
    comment

    Let's be honest about the normal ComfyUI save flow: your IMAGE tensor gets decoded, then written to a PNG, and if you want a JPEG you convert afterwards or pile on metadata-extraction nodes to reconstruct what the default Save Image dropped. GM Image JPEG Save (class GMImageJpegSave) from ruminar/ComfyUI-GMImageSaver just skips that whole detour. It takes the IMAGE tensor, pipes it straight into GraphicsMagick, and writes a .jpg. No intermediate PNG, no preview, no passthrough - it's a single-purpose output node, and it wears that narrowness as a feature.

    It's a niche tool, and the author knows it. The README is unapologetic: JPEG only, preview-less on purpose, no metadata auto-injection. This is the node you reach for when you're doing a big batch - a grid run of a hundred checkpoints, a pile of variations to sort through - and you want small files, sane folders, and a filename that tells you which model made it, without burning SSD writes on giant PNGs. For PNG keepers, use ComfyUI's built-in Save Image; this one is explicitly not that.

    How it works

    The trick is in the plumbing. GMImageJpegSave converts the tensor to raw RGB bytes in memory and feeds them over stdin to gm convert -size WxH -depth 8 rgb:- with your quality, sampling, and interlace flags. That's why it needs GraphicsMagick installed and on the PATH - it shells out to the gm binary, and it will raise a clear "please install GraphicsMagick and restart ComfyUI" error if it can't find it. Nothing is written to disk until the final JPEG lands, so the only I/O is the file you actually want. It also updates ComfyUI's progress bar per image and renames safely: invalid filename characters get scrubbed, Windows reserved names like CON get prefixed, and relative output_dir paths are guarded against .. traversal.

    The inputs that matter

    There are a lot of inputs, but a beginner really sets three.

    • filename_prefix - the base name. Defaults to image.
    • directory_pattern - pick from 14 layouts like prefix/date, label/date, prefix_label_date. The date part is always yyyyMMdd, and patterns containing label require the label pin or the node refuses to run.
    • quality (1–100, default 80) and subsampling (4:4:4 / 4:2:2 / 4:2:0) - quality vs. size trade-off. For sorting a big batch, quality 75–85 with 4:2:0 keeps files small; for keepers you re-save at 95 / 4:4:4.

    The optional pins are where it gets useful: label accepts things like a checkpoint name (think ckpt_name_safe from model-management packs) and weaves it into filenames and folders - image_meinamix_v11_20260601_0001.jpg and you instantly know what produced it. output_dir sends files anywhere (absolute path saves there directly; relative goes under ComfyUI's output folder); unconnected, it uses the standard output dir. comment embeds a text comment into the JPEG itself. filename_date_format stamps the filename with yyyyMMdd or yyyyMMdd_HHmm, and progressive enables interlaced JPEG for slow-network viewers.

    There are no outputs - it's an end-of-graph output node. Because it returns nothing and previews nothing, keep a preview node on a parallel branch off VAE Decode if you actually want to see your images in the UI.

    Installing it

    Two steps: GraphicsMagick first, then the node.

    # Debian/Ubuntu
    sudo apt install graphicsmagick
    gm version   # verify it's on your PATH
    

    On Windows, install GraphicsMagick with the command-line tools enabled and confirm gm version works in a terminal. Then install the node via ComfyUI Manager (search "GM Image Saver"), or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/ruminar/ComfyUI-GMImageSaver
    

    Restart ComfyUI. There are no Python dependencies (the pyproject.toml lists none) - the one real requirement is that gm is reachable from the process that launches ComfyUI.

    Where people get burned

    The classic failure is forgetting step one: you install the node, run it, and get the GraphicsMagick-not-found error. The fix is installing gm, not reinstalling the pack. The other gotcha is the label requirement - pick a label-based directory pattern without connecting anything, and it throws. And if you're coming from Save Image, the lack of a preview thumbnail feels broken until you remember it's deliberate. For a tiny, opinionated utility, that's about the whole failure surface - it fails loudly and tells you exactly what's wrong, which is more than most nodes manage.

    Categoryimage/GMImageSaver

    Inputs (10)

    NameTypeDefaultDescription
    imagesIMAGE
    filename_prefixSTRINGimage
    directory_patternCOMBOprefix/date14 options: none, date, prefix, prefix_date, prefix/date, label, +8
    filename_date_formatCOMBOnone3 options: none, yyyyMMdd, yyyyMMdd_HHmm
    qualityINT801–100
    subsamplingCOMBO4:2:23 options: 4:4:4, 4:2:2, 4:2:0
    progressiveBOOLEANfalse
    output_diroptSTRING
    labeloptSTRING
    commentoptSTRING

    Outputs (0)

    No outputs