You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
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).
@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!
Activity
tacaswell commentedon Oct 12, 2026
We don't currently have an
imagecodecsdependency (optional or required), but do have a hard dependency on pillow. I think the best path here is to add the support for dispatching.jxlto the pillow backend and letting any errors from that bubble back to the user (maybe with araise fromsuggesting a missing dependency).Kaustav5505g commentedon Oct 19, 2026
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!