From 358150b83765aaafe88eedee9f85c9fa15f5ec8c Mon Sep 17 00:00:00 2001 From: Andrew Murray Date: Sat, 22 Nov 2025 17:33:06 +1100 Subject: [PATCH] libjxl < 0.9.0 is not supported. See https://github.com/libjxl/libjxl/issues/4400 --- .ci/install.sh | 2 +- docs/installation/building-from-source.rst | 8 ++++++-- docs/reference/features.rst | 1 + docs/reference/plugins.rst | 8 ++++++++ src/PIL/features.py | 2 +- 5 files changed, 17 insertions(+), 4 deletions(-) diff --git a/.ci/install.sh b/.ci/install.sh index c4c49d6a1..2178c6646 100755 --- a/.ci/install.sh +++ b/.ci/install.sh @@ -18,7 +18,7 @@ aptget_update || aptget_update retry || aptget_update retry set -e sudo apt-get -qq install libfreetype6-dev liblcms2-dev libtiff-dev python3-tk\ - ghostscript libjpeg-turbo8-dev libjxl-dev libopenjp2-7-dev\ + ghostscript libjpeg-turbo8-dev libopenjp2-7-dev\ cmake meson imagemagick libharfbuzz-dev libfribidi-dev\ sway wl-clipboard libopenblas-dev nasm diff --git a/docs/installation/building-from-source.rst b/docs/installation/building-from-source.rst index 59c595742..7840e5c46 100644 --- a/docs/installation/building-from-source.rst +++ b/docs/installation/building-from-source.rst @@ -97,6 +97,10 @@ Many of Pillow's features require external libraries: and decoder, such as rav1e and dav1d, or libaom, which both encodes and decodes AVIF images. +* **libjxl** provides support for the JPEG XL format. + + * Pillow requires libjxl version **0.9.0** or greater. + .. tab:: Linux If you didn't build Python from source, make sure you have Python's @@ -284,7 +288,7 @@ Build options ``-C tiff=disable``, ``-C freetype=disable``, ``-C raqm=disable``, ``-C lcms=disable``, ``-C webp=disable``, ``-C jpeg2000=disable``, ``-C imagequant=disable``, ``-C xcb=disable``, - ``-C avif=disable``. + ``-C avif=disable``, ``-C jpegxl=disable``. Disable building the corresponding feature even if the development libraries are present on the building machine. @@ -292,7 +296,7 @@ Build options ``-C tiff=enable``, ``-C freetype=enable``, ``-C raqm=enable``, ``-C lcms=enable``, ``-C webp=enable``, ``-C jpeg2000=enable``, ``-C imagequant=enable``, ``-C xcb=enable``, - ``-C avif=enable``. + ``-C avif=enable``, ``-C jpegxl=enable``. Require that the corresponding feature is built. The build will raise an exception if the libraries are not found. Tcl and Tk must be used together. diff --git a/docs/reference/features.rst b/docs/reference/features.rst index 45067ba35..01ae4582c 100644 --- a/docs/reference/features.rst +++ b/docs/reference/features.rst @@ -22,6 +22,7 @@ Support for the following modules can be checked: * ``littlecms2``: LittleCMS 2 support via :py:mod:`PIL.ImageCms`. * ``webp``: WebP image support. * ``avif``: AVIF image support. +* ``jpegxl``: JPEG XL image support. .. autofunction:: PIL.features.check_module .. autofunction:: PIL.features.version_module diff --git a/docs/reference/plugins.rst b/docs/reference/plugins.rst index 243d4f353..b5e7b6346 100644 --- a/docs/reference/plugins.rst +++ b/docs/reference/plugins.rst @@ -169,6 +169,14 @@ Plugin reference :undoc-members: :show-inheritance: +:mod:`~PIL.JpegXlImagePlugin` module +------------------------------------ + +.. automodule:: PIL.JpegXlImagePlugin + :members: + :undoc-members: + :show-inheritance: + :mod:`~PIL.McIdasImagePlugin` module ------------------------------------ diff --git a/src/PIL/features.py b/src/PIL/features.py index 8064bc2a6..1bfa40020 100644 --- a/src/PIL/features.py +++ b/src/PIL/features.py @@ -15,9 +15,9 @@ modules = { "tkinter": ("PIL._tkinter_finder", "tk_version"), "freetype2": ("PIL._imagingft", "freetype2_version"), "littlecms2": ("PIL._imagingcms", "littlecms_version"), - "jpegxl": ("PIL._jpegxl", "libjxl_version"), "webp": ("PIL._webp", "webpdecoder_version"), "avif": ("PIL._avif", "libavif_version"), + "jpegxl": ("PIL._jpegxl", "libjxl_version"), }