[ENH]: Support JPEG XL output in savefig() · Issue #32467 · matplotlib/matplotlib · GitHub
Skip to content

[ENH]: Support JPEG XL output in savefig() #32467

Open

Description

@EwoutH

Problem

Matplotlib does not natively support exporting figures in JPEG XL (.jxl) format. JPEG XL offers efficient lossless and lossy compression, high bit-depth support, and potentially smaller files than PNG or JPEG, making it attractive for scientific visualizations, particularly raster-heavy figures. Currently, users must rely on external conversion tools or additional processing steps.

Proposed solution

Add JPEG XL as an optional raster output format for savefig(), ideally using an existing backend such as imagecodecs or a Pillow JPEG XL plugin, without introducing a mandatory dependency.

For example:

fig.savefig("figure.jxl", format="jxl")

Ideally, the implementation would support lossless encoding by default, optional lossy compression settings, and appropriate metadata preservation.

Activity

  1. tacaswell commented on Oct 12, 2026

    @tacaswell
    Member

    We don't currently have an imagecodecs dependency (optional or required), but do have a hard dependency on pillow. I think the best path here is to add the support for dispatching .jxl to the pillow backend and letting any errors from that bubble back to the user (maybe with a raise from suggesting a missing dependency).

  2. Kaustav5505g commented on Oct 19, 2026

    @Kaustav5505g

    Hi everyone!

    @tacaswell's suggestion makes total sense—relying on Pillow to handle the .jxl dispatch without introducing extra optional dependencies keeps things clean and lightweight.

    I’d love to pick this up and work on a PR for it. I'll look into registering .jxl in the Pillow backend and making sure any missing-dependency errors bubble up gracefully with a helpful message.

    Does anyone have any early preferences or edge cases they'd like me to keep in mind (e.g., default lossless/lossy parameters)? I'll get started on a draft soon!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions