Jbig2Filter
in package
implements
FilterInterface
JBIG2Decode filter — ISO 14492 / ITU-T T.88 codec.
Encodes/decodes JBIG2-compressed bitonal image data. JBIG2 is a complex multi-segment format supporting symbol dictionaries, text regions, halftone regions, and generic regions with arithmetic or MMR coding.
This implementation handles the most common PDF JBIG2 patterns:
- Generic regions with MMR coding (internally Group 4 fax)
- Immediate lossless generic regions
- Page information segments for dimensions
Encoding produces MMR-coded immediate lossless generic regions, wrapping CCITTFax Group 4 data in JBIG2 segment structure.
For complex JBIG2 streams (symbol dictionaries, arithmetic coding),
decoding falls back to the jbig2dec CLI tool if available, otherwise
returns the raw data unchanged.
PDF-embedded JBIG2 streams do NOT include the file header — they contain only segment data. Global segments (symbol dictionaries) are provided separately via /JBIG2Globals in /DecodeParms.
Tags
Table of Contents
Interfaces
- FilterInterface
- Symmetric encode/decode contract for PDF stream filters (ISO 32000-2 §7.4).
Methods
- __construct() : mixed
- decode() : string
- encode() : string
Methods
__construct()
public
__construct([string $globals = '' ][, int $width = 0 ][, int $height = 0 ]) : mixed
Parameters
- $globals : string = ''
-
Optional JBIG2 global segments data (from /JBIG2Globals)
- $width : int = 0
-
Image width in pixels (required for encoding)
- $height : int = 0
-
Image height in pixels (required for encoding)
decode()
public
decode(string $data) : string
Parameters
- $data : string
Return values
stringencode()
public
encode(string $data) : string
Parameters
- $data : string