Nodes/ComfyUI_jxl_support/Save Image (JXL)
ComfyUI Node

Save Image (JXL)

Save Image (JXL)

By koloved·Created 2 months ago·Updated 2 months ago· 2
Save Image (JXL)
  • images
    filename_prefixComfyUI
    quality100
    compress_metadatatrue

    If you batch-generate all day, your ComfyUI/output folder is the thing filling up your disk, and PNG is doing you no favors. Save Image (JXL) is a drop-in replacement for the built-in Save Image that writes JPEG XL instead - and lossless JXL is about 40% smaller than lossless PNG. The pack's own example: a 1024×1024 render that's 1.58 MB as PNG comes out at 0.99 MB as JXL with zero quality loss. Same pixels, roughly a third less disk, and the workflow is still embedded in the file so you keep the "drag the output back in to recover the graph" behavior ComfyUI users live on.

    How it works

    It's the standard Save Image shape: feed it an IMAGE, give it a filename prefix, and it writes numbered .jxl files to your output directory using the same prefix_00001_.jxl naming scheme you already know. Under the hood, imagecodecs does the encoding. Quality 100 switches to true lossless mode. Below 100 it converts your number into JPEG XL's native "distance" metric ((100 - quality) * 0.15) and goes lossy, which is where the file sizes get silly - the README shows a quality-40 render at 99 KB.

    The interesting part is what it embeds. ComfyUI hands every output node the prompt and workflow JSON, and this node stuffs that into a brob metadata box inside the JXL container - Brotli-compressed by default. That's why your output file isn't just a picture: drop it back onto the canvas and the whole graph reconstructs, just like a PNG. Compressed, that workflow blob is a few KB; uncompressed it can be 100+ KB, which is why compress_metadata defaults to on.

    The inputs that matter

    Four inputs, and you'll touch two of them:

    • quality - 0 to 100, default 100. 100 is lossless (the 40%-smaller-than-PNG sweet spot). Drop to 60–80 for archival where "good enough" beats "perfect," or way down for thumbnails. This is the knob you'll actually change.
    • compress_metadata - Boolean, default True. Leave it on unless you're deliberately comparing sizes. Turning it off doesn't lose the workflow, it just bloats the file.
    • images - the IMAGE tensor. Wire in whatever your workflow ends with.
    • filename_prefix - same as the stock Save Image, default ComfyUI.

    Installing it

    ComfyUI Manager: search ComfyUI_jxl_support and install. Manual:

    cd ComfyUI/custom_nodes/
    git clone https://github.com/koloved/ComfyUI_jxl_support
    cd ComfyUI_jxl_support && pip install -r requirements.txt
    

    That requirements line matters - the README's install section omits it, but the pack needs imagecodecs (the JXL codec) and brotli (metadata compression). Manager installs dependencies automatically; manual cloners have to. Wheels exist for current Python on all three OSes, so it's usually painless.

    Where people get burned

    The same gotcha as its sibling Load node: your browser won't render JXL, so output previews show blank until you flip on JXL support (Chrome/Edge: chrome://flags/#enable-jxl-image-format → Enabled; Firefox: image.jxl.enabled in about:config). The file is fine - your disk and your viewers are the ones catching up.

    And a take worth taking, from the author himself: "for compressed anime images, Avif is significantly better than JXL." JPEG XL wins for photographic output and lossless archiving, but if you generate flat-color anime you may get better mileage from an AVIF save node. Related: lossy JXL has had color-management complaints in some viewers - mostly with wide-gamut images, which AI output in sRGB usually sidesteps.

    One more note: the author is folding JXL into Save Image Extended (it's a pending PR there). If you already live in that ecosystem, you might get this for free soon; if not, this standalone node does the job today.

    Categoryimage

    Inputs (4)

    NameTypeDefaultDescription
    imagesIMAGE
    filename_prefixSTRINGComfyUI
    qualityINT1000–100
    compress_metadataBOOLEANtrue

    Outputs (0)

    No outputs