This repository contains a simpler encoder implementation of JPEG XL, aimed at photographic images without an alpha channel. The goal is to guide hardware implementations of the encoder where support for the full set of encoding tools is not feasible. The color management is outside the scope of this library, the encoder input is given as a portable float map (PFM) in the linear sRGB colorspace, where individual sample values can be outside the [0.0, 1.0] range for out-of-gammut colors. For more details, see the overview of the coding tools.
JPEG XL is in the final stages of standardization and its codestream and file format are frozen.
The library API, command line options, and tools in this repository are subject
to change, however files encoded with cjxl_tiny
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-tiny.git --recursive --shallow-submodules
This repository uses git submodules to handle some third party dependencies
under 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 --depth 1 --recommend-shallow
The --shallow-submodules
and --depth 1 --recommend-shallow
options create
shallow clones which only downloads the commits requested, and is all that is
needed to build libjxl-tiny
. Should full clones be necessary, you could always run:
git submodule foreach git fetch --unshallow
git submodule update --init --recursive
which pulls the rest of the commits in the submodules.
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
We recommend using a recent Clang compiler (version 7 or newer), for that
install clang and set CC
and CXX
variables.
sudo apt install clang
export CC=clang CXX=clang++
cd libjxl-tiny
mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=OFF ..
cmake --build . -- -j$(nproc)
The encoder tool cjxl_tiny
will be available in the build/encoder
directory.
sudo cmake --install .
To encode a source image to JPEG XL with default settings:
build/encoder/cjxl_tiny input.pfm output.jxl
For more settings run build/encoder/cjxl_tiny --help
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 container as explained in the step by step guide.
For experienced developers, we provide build instructions for several other environments:
- Building on Debian
- Building on Windows with vcpkg (Visual Studio 2019)
- Building on Windows with MSYS2
- Cross Compiling for Windows with Crossroad
If you encounter any difficulties, please use Docker instead.
This software is available under a 3-clause BSD license which can be found in the LICENSE file, with an "Additional IP Rights Grant" as outlined in the PATENTS file.
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.
- JPEG XL Format Overview
- Introductory paper (open-access)
- XL Overview - a brief introduction to the source code modules
- JPEG XL white paper
- JPEG XL official website
- JPEG XL community website
- More information on testing/build options
- Git guide for JPEG XL - for developers
If you encounter a bug or other issue with the software, please open an Issue here.
There is a subreddit about JPEG XL, and
informal chatting with developers and early adopters of libjxl
can be done on the
JPEG XL Discord server.