cjxl
TLDR
Encode an image to JPEG XL format with default settings
SYNOPSIS
cjxl [options] input output.jxl
DESCRIPTION
cjxl is the reference encoder for JPEG XL, a next-generation image format designed to replace both JPEG and PNG. It is part of the libjxl project maintained by the JPEG committee.
JPEG XL offers superior compression compared to legacy formats, supporting both lossy and lossless modes. A unique feature is the ability to losslessly transcode existing JPEG files, reducing their size by approximately 20% while allowing perfect reconstruction of the original JPEG.
The encoder supports a wide range of input formats including PNG, APNG, GIF, JPEG, PPM, and PFM. It handles high bit depths, HDR content, and animations natively. The effort parameter provides a trade-off between encoding speed and compression ratio.
PARAMETERS
-q N, --quality=N
Quality setting from 1 to 100. 100 is mathematically lossless. Default is 90.-d N, --distance=N
Target visual distance (0=lossless, 1.0=visually lossless, higher means more compression). Overrides quality.-e N, --effort=N
Encoder effort level from 1 to 9. Higher values produce smaller files but encode slower. Default is 7.--lossless_jpeg=N
When encoding JPEG input, 1 preserves the original JPEG data for bit-exact reconstruction.-j, --jpeg_transcode
Lossless JPEG transcode mode (shortcut for --lossless_jpeg=1).--num_threads=N
Number of threads to use. 0 means use all available cores.--progressive
Enable progressive decoding for the output file.--premultiply=N
Premultiply alpha channel (0=no, 1=yes, -1=auto).-h, --help
Display help information and exit.-v, --verbose
Enable verbose output.
CAVEATS
Browser support for JPEG XL is limited as of 2024. The lossless JPEG transcode feature only works with standard baseline JPEGs and may fail on progressive or arithmetic-coded JPEGs. High effort levels significantly increase encoding time.
HISTORY
JPEG XL was standardized as ISO/IEC 18181 in 2022. The format was developed by the JPEG committee, combining technologies from Google's PIK and Cloudinary's FUIF projects. The cjxl encoder is part of the reference implementation released by the libjxl project starting in 2019.


