SharpAstro.Jbig2
Pure-managed JBIG2 (ITU-T T.88) bilevel image decoder for .NET, written clean-room from the specification and aimed at PDF's /JBIG2Decode filter. A PDF-embedded JBIG2 stream is not a file โ it has no file header, its segment dictionaries live out of band in /DecodeParms /JBIG2Globals, and its dimensions come from the image dictionary โ so the primary entry point takes exactly those pieces: Jbig2Decoder.Decode(embedded, globals, width, height). Standalone .jb2 files (sequential and random-access organisation) also decode, and register with the SharpAstro.Codecs facade by magic bytes. Scope in 3.7: the complete arithmetic decoding path โ MQ arithmetic decoder (Annex E), generic regions both ways (templates 0-3 with TPGDON and arbitrary AT pixels, and MMR / ITU-T T.6, the CCITT Group 4 coding), generic refinement regions, symbol dictionaries and text regions (every reference corner, transposed strips, per-instance refinement, refine/aggregate symbols, and cross-stream dictionaries via /JBIG2Globals), pattern dictionaries and halftone regions, page information, and region composition (OR/AND/XOR/XNOR/REPLACE). Validated against jbig2enc output, libtiff Group 4 output, and the jbig2dec reference decoder. Not implemented: the Huffman-coded variants (SDHUFF/SBHUFF and custom table segments), MMR inside pattern dictionaries and halftone regions, HENABLESKIP, and TPGRON in a refinement region โ each throws NotSupportedException naming the feature rather than returning a wrong raster. Output is one byte per pixel (1 = black, T.88's own polarity) plus an 8-bit grey projection; /Decode inversion and ImageMask semantics stay in the caller's PDF layer. Hardened in 3.8 against hostile streams โ since a PDF-supplied codestream chooses its own region dimensions and T.88's arithmetic decoder keeps producing decisions past the end of its data, decoding is bounded by a 2^28-pixel ceiling per bitmap plus a total budget scaled to the caller's page size, and every decoding loop is guaranteed to make progress; malformed input raises InvalidDataException rather than exhausting memory or spinning. AOT-compatible.
Install
dotnet add package SharpAstro.Jbig2 --version 3.14.871+43ac2412bbc86a491c7bc41d48c6828f0b8af1f1
Install-Package SharpAstro.Jbig2 -Version 3.14.871+43ac2412bbc86a491c7bc41d48c6828f0b8af1f1
<PackageReference Include="SharpAstro.Jbig2" Version="3.14.871+43ac2412bbc86a491c7bc41d48c6828f0b8af1f1" />
Frameworks
Dependencies
Adoption guide
Assess this package against its supported frameworks, license, maintenance signals and dependency graph before making it a project standard.
No SPDX license expression is published. Review the license text and your organisation's policy before redistribution.
Compatibility metadata lists 1 target framework; confirm the exact target used by your application.
How to read this guidance
Sources: published NuGet v3 registry metadata and explicit NuBrowse editorial guides. Refresh: package metadata is refreshed from NuGet when the page loads. Limit: this is not a security, legal or compatibility guarantee; validate the selected version in your project.
Useful next steps
Move from package metadata to a concrete selection or review workflow.