You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add JPEG XL (JXL) image decoding support to PDFium using jxl-rs, a pure Rust decoder. This enables PDFs that embed JXL-compressed image XObjects (per the upcoming PDF Association / ISO standardization work) to render correctly in PDFium.
JXL benefits:
30–50% better compression than JPEG (typical for photographic content)
Lossless JPEG transcoding (recompress JPEG sources without generation loss)
Progressive decoding
Animation support in the format
PDF behavior:
PDFs do not have an animation model for image XObjects; therefore animated JXL must render as the first frame only (deterministic output).
Security rationale:
Using a Rust decoder provides memory safety guarantees for image parsing/decoding, reducing attack surface compared to C/C++ decoders.
Platforms
PDFium runs wherever Chromium/PDFium runs. At minimum (Chromium distribution):
macOS
Windows
Linux
ChromeOS
Android
Android WebView
(For standalone embedders, platform coverage depends on the adopted Rust toolchain/build policy.)
Team
Author: Helmut Januschka
Bug
TBD (file a PDFium/Chromium bug for “JXL-in-PDF decode via jxl-rs”)
CL
TBD
Code affected (expected)
PDF image filter dispatch: CPDF_DIB::CreateDecoder() adds a new JXL filter branch
New codec glue: LoadJxlBitmap() (whole-image decode analogous to existing LoadJpxBitmap())
Build configuration:
new buildflag(s) like pdf_enable_rust and pdf_enable_jxl_decode
GN plumbing to build Rust + cxx bridge for standalone PDFium
Add support for embedding and decoding JPEG XL (JXL) images in PDFs rendered by PDFium.
Key constraints:
Rust-only decoder: must use jxl-rs. C++ libjxl is not an option.
Animation: if the embedded JXL is animated, PDFium renders only the first frame (PDF image XObjects are not animated).
Embedders: PDFium is used standalone by external embedders; therefore we likely need a standalone PDFium Rust toolchain story and an in-tree vendored copy of the required Rust crates.
2. Goals and non-goals
2.1 Goals (checkable)
A PDF with an image XObject using the standardized JXL filter renders correctly in PDFium.
Animated JXL is handled deterministically by rendering frame 0 only.
Decoding is robust against malicious inputs (pixel limits, allocation guards, timeouts where applicable).
Unit/regression tests exist for:
basic decode
truncated/corrupt streams
very large dimensions / allocation refusal
animated file → first frame rendered
Fuzz coverage exists for the new JXL decoding entry points.
2.2 Non-goals
Not adding any encoding support (PDF creation with JXL is out of scope for PDFium).
Not supporting JXL animation playback in PDFs.
Not integrating C++ libjxl (explicitly disallowed).
Not solving broader Chromium Skia/libjxl migration.
3. Background
3.1 Current PDFium state
PDFium decodes PDF image XObjects via CPDF_DIB, with filter dispatch in:
Supported image filters today include /DCTDecode (JPEG), /JPXDecode (JPEG2000), /JBIG2Decode, etc. There is no JXL filter recognized.
A repository search shows no integration with JXL decoders. The only JXL mention found in this checkout is a TIFF compression constant in third_party/libtiff, unrelated to PDF image XObjects.