This repository contains a reference implementation of JPEG XL (encoder and
JPEG XL is in the final stages of standardization and its codestream format is frozen.
The libraries API, command line options and tools in this repository are subject
to change, however files encoded with
cjxl conform to the JPEG XL format
specification and can be decoded with current and future
djxl decoders or
libjxl decoding library.
For more details and other workflows see the "Advanced guide" below.
git clone https://github.com/libjxl/libjxl.git --recursive
This repository uses git submodules to handle some third party dependencies
third_party/, that's why is important to pass
--recursive. If you
didn't check out with
--recursive, or any submodule has changed, run:
git submodule update --init --recursive.
Important: If you downloaded a zip file or tarball from the web interface you
won't get the needed submodules and the code will not compile. You can download
these external dependencies from source running
./deps.sh. The git workflow
described above is recommended instead.
Required dependencies for compiling the code, in a Debian/Ubuntu based distribution run:
sudo apt install cmake pkg-config libbrotli-dev
Optional dependencies for supporting other formats in the
in a Debian/Ubuntu based distribution run:
sudo apt install libgif-dev libjpeg-dev libopenexr-dev libpng-dev libwebp-dev
We recommend using a recent Clang compiler (version 7 or newer), for that
install clang and set
CXX variables. For example, with clang-7:
sudo apt install clang-7 export CC=clang-7 CXX=clang++-7
cd libjxl mkdir build cd build cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=OFF .. cmake --build . -- -j$(nproc)
The encoder/decoder tools will be available in the
sudo cmake --install .
To encode a source image to JPEG XL with default settings:
build/tools/cjxl input.png output.jxl
For more settings run
build/tools/cjxl --help or for a full list of options
build/tools/cjxl -v -v --help.
To decode a JPEG XL file run:
build/tools/djxl input.jxl output.png
djxl are able to read/write the following
image formats: .exr, .gif, .jpeg/.jpg, .pfm, .pgm/.ppm, .pgx, .png.
For speed benchmarks on single images in single or multi-threaded decoding
djxl can print decoding speed information. See
djxl --help for details
on the decoding options and note that the output image is optional for
For more comprehensive benchmarking options, see the benchmarking guide.
We build a common environment based on Debian/Ubuntu using Docker. Other systems may have different combinations of versions and dependencies that have not been tested and may not work. For those cases we recommend using the Docker environment as explained in the step by step guide.
Please note that the PATENTS file only mentions Google since Google is the legal entity receiving the Contributor License Agreements (CLA) from all contributors to the JPEG XL Project, including the initial main contributors to the JPEG XL format: Cloudinary and Google.
If you encounter a bug or other issue with the software, please open an Issue here.