Pillow plugin for JPEG-XL, using Rust for bindings.
- JPEG-XL Plugin for Pillow
- Encoder/Decoder to work with JPEG-XL using safe wrapper
- Support EXIF metadata encoding
pip install pillow-jxl-plugin
Make sure Rust
and maturin installed, then run:
git clone https://github.com/Isotr0py/pillow-jpegxl-plugin
cd pillow-jpegxl-plugin
maturin build --release --features vendored
If you have libjxl
installed and want to use dynamic link, run:
maturin build --release --features dynamic
Use import pillow_jxl
to register the plugin in your code.
import pillow_jxl
from PIL import Image
# Lossless encode a png image
with Image.open("example.png") as img:
img.save("example.jxl",lossless=True)
# encode image with JPEG-Style quality
with Image.open("example.png") as img:
img.save("example.jxl", quality=98)
# Lossless construct from a jpeg image
with Image.open("example.jpg") as img:
img.save("example.jxl",lossless=True)
# Decode jxl image
with Image.open("example.jxl") as img:
display(img)
Wheels | Windows 64-bit | MacOS | manylinux |
---|---|---|---|
CPython3.8 | ✔ | ✔ | ✔ |
CPython3.9 | ✔ | ✔ | ✔ |
CPython3.10 | ✔ | ✔ | ✔ |
CPython3.11 | ✔ | ✔ | ✔ |
CPython3.12 | ✔ | ✔ | ✔ |
CPython3.13 | ❌ | ❌ | ✔ |
PyPy3.8 | ❌ | ❌ | ✔ |
PyPy3.9 | ❌ | ❌ | ✔ |
PyPy3.10 | ❌ | ❌ | ✔ |