pdfluent-jbig2
A pure-Rust JBIG2 image decoder, used to decode JBIG2-compressed images embedded in PDF documents.
pdfluent-jbig2 is one of the open-source foundation crates used by the
PDFluent commercial Rust PDF SDK. It is published as
MIT OR Apache-2.0 so it can also be used standalone.
This crate is a fork of hayro-jbig2
by Laurenz Stampfl. The fork is maintained by PDFluent for coordinated
exact-version pinning across the workspace.
What this crate gives you
- Decode JBIG2-encoded image data (the
/Filter /JBIG2DecodePDF stream) - Generic-region, text-region, and pattern-dictionary segments
- Both end-of-stream and per-segment generic decoding modes used in PDF
- Pure Rust — memory-safe, no C dependency, compiles to WebAssembly
JBIG2 is mostly used for scanned monochrome documents where it produces significantly smaller files than CCITT G4.
What this crate is not:
- Not a JBIG2 encoder (we only decode what is already in PDFs)
- Not a generic image processing library
Usage
This crate is most often invoked transitively via PDFluent's PDF stream filtering layer. Direct usage:
[]
= "0.2"
For PDF-level JBIG2 decoding (with the right glyph segment context handled
by the PDF reader), prefer the pdfluent
facade.
License
MIT OR Apache-2.0 — preserved from upstream hayro-jbig2.
Copyright (c) Laurenz Stampfl (hayro-jbig2)
Copyright (c) 2026 Innovation Trigger BV (PDFluent fork)
See LICENSE-MIT and LICENSE-APACHE.
Links
- PDFluent SDK: https://pdfluent.com
cargo add pdfluent(full SDK): https://crates.io/crates/pdfluent- Upstream hayro: https://github.com/LaurenzV/hayro