Jxltree: JPEG to JPEG XL Lossless Batch Transcoder

Did you know you can transcode plain JPEG images to JPEG XL, and you can reconstruct the original bit-perfect JPEG? The best part is that the transcoded JPEG XL images are typically around 20% smaller than the original.

This program is a command line (CLI) tool that batch transcodes JPEG images to JPEG XL images, and back forth (reconstructing JPEG). The tool works on Linux, FreeBSD, macOS and Microsoft® Windows™. While transcoding, directory structure and file modification times are preserved. Non-JPEG files such as *.mp4 and *.mov are copied to the new destination without modification. This behavior makes it perfect for archival purposes.

Performance is the key advantage of using this program. This program is implemented in C++, and uses oneAPI Thread Building Blocks (TBB) to utilize multiple processor cores for transcoding. Also reduces memory usage through the use of memory mapping in zero-copy fashion.

Usage

Example: transcode

Operation diagram for transcoding
Operation for jxltree aaa aaa_transcoded

Use jxltree like this to transcode JPEG images to JPEG XL images:

jxltree src_dir dest_dir

This does the following operations:

  1. Creates directory structure below src_dir to dest_dir (also see the figure above).
  2. Transcode *.jpg or *.jpeg (case insensitive) to path in the dest_dir.
  3. Copy non-JPEG files to corresponding directory under dest_dir.
  4. Set modification time of the transcoded JPEG XL file identical to source JPEG file.
  5. Report number of files transcoded and copied, and number of errors.

This is a lossless process; the resulting JXL files can be used to reconstruct the original JPEG bit-perfectly.

Optionally use -e effort to balance between speed and compression ratio. Default is 10 for maximum compression. -v option can be used to show transcoding progress before processing each file.

Transcoding is a computationally intensive process and it takes a fair amount of memory depending on the source image size and number of threads. Use -j threads to adjust the number of threads used. This defaults to the number of logical processors available.

Example: reconstruct

Operation diagram for reconstructing
Operation for jxltree -r aaa aaa_transcoded

-r option is used for reconstructing JPEG files from transcoded JPEG XL files:

jxltree -r src_dir dest_dir

This works like this:

  1. Creates directory structure below src_dir to dest_dir (also see the figure above).
  2. When *.jxl (case insensitive) is found in src_dir, reconstruct JPEG in the corresponding path in the dest_dir, replacing the file name extension to .jpg.
  3. Copy non-JXL files to corresponding directory under dest_dir.
  4. Set modification time of the reconstructed JPEG file identical to source JPEG XL file.
  5. Report number of files reconstructed and copied, and number of errors.

-v and -j options can be used in the same manner as transcoding.

Download

Building Tips

Please refer to README.md for details.

Linux, FreeBSD and macOS

These platforms use GNU Make and Makefile for building.

For Linux on AArch64 platform, OCI Container (Docker container) image is available at the GitLab Container Registry for convenience.

Microsoft® Windows™

This program is built using Microsoft® Visual C++™ 2026 with CMake and vcpkg bundled with the Visual Studio™. The author used community edition of the said software. For detailed building procedure see README.md. Prebuilt binaries for x64 and arm64 architectures are available at GitLab releases page and Vector website above for convenience.

License

Apache-2.0