Repository navigation
Releases
gojxl v0.2.0
Faster single-thread decoding, grey images stored as grey, a thread cap for servers and a faster JPEG recompression effort.
Decoding
- Gaborish and all EPF iterations now run in one pass over rows (bit-identical output): on one thread a 2 MP photo decodes in 77 instead of 87 ms at distance 1, 82 instead of 93 ms at distance 2 and 126 instead of 151 ms at distance 4.5; with
GOEXPERIMENT=simd, 57 instead of 72 ms at distance 1. - The output curve tables are built once per process instead of per decode: a 256×256 image decodes in 2.5 instead of 3.7 ms.
- Against the other Go libraries (timed again with a warm-up, see the README): gojxl decodes lossy files 14–15 % faster than gen2brain/jxl on 4 threads; on one thread gen2brain/jxl, which uses SIMD assembly, is 2–10 % faster (v0.1.0's README said about twice as fast; those runs were probably cold).
Encoding
- Grey images are stored as grey also when lossy or with alpha, and colour images whose samples are all grey (as grey+alpha PNGs decode) become one channel: decoders write grey PNGs for them.
TranscodeJPEGEffort: efforts 1–3 code the DC coefficients with a fixed context model, about 15 % faster on one thread for 0.7 % larger files; the default is unchanged.ConvertToJXLand the CLI's-enow pass the effort on for JPEG input.
Servers
SetMaxThreads(n)caps the goroutines a conversion computes on, process-wide; with 1 a conversion starts no goroutine.- A panic in a worker goroutine (malformed input reaching a bug) now reaches the caller as an error instead of ending the program.
Install: go install github.com/bdrtr/gojxl/cmd/gojxl@v0.2.0 (Go 1.24+), or download a binary below and check it against SHA256SUMS. The macOS binaries are not notarized: run xattr -d com.apple.quarantine gojxl after unpacking if macOS blocks them.
gojxl v0.1.0
First public release of gojxl, a JPEG XL encoder, decoder and converter written in pure Go (no cgo, no assembly, no WASM).
Highlights
- Lossy files 8.2 % smaller than
cjxl -e 7on photos and 10.2 % smaller on diagrams, icons and screenshots at equal SSIMULACRA 2 (BD-rate). - Faster than libjxl's
djxlwhen converting JPEG XL to PNG on 4 threads (1.2 to 1.9× on a 5 MP photo); lossless encoding 1.8× faster thancjxl -e 7at the same size. - Lossless JPEG recompression with byte-exact reconstruction (also of files made by cjxl).
- Inputs: PNG/APNG, GIF, JPEG, WebP, TIFF, BMP, PNM. Outputs: PNG/APNG, JPEG, PNM, PFM. Animation, alpha, 16-bit, HDR and ICC colour management.
- Validated against the libjxl conformance suite and a 1,983-file real-world corpus.
Install: go install github.com/bdrtr/gojxl/cmd/gojxl@v0.1.0 (Go 1.24+), or download a binary below and check it against SHA256SUMS. The macOS binaries are not notarized: run xattr -d com.apple.quarantine gojxl after unpacking if macOS blocks them.