Expand description
Decoder for PaperPort 2 (.max) image scans.
The PaperPort 2 file format (“ViGBe”) is a proprietary container used by ScanSoft’s PaperPort 2 (1996) for 1-bit scanned documents. Each image chunk wraps a CCITT-T.6 (Group 4 fax) compressed bitmap with a custom per-line marker dispatcher.
§Quick start
use vigb_decoder::{decode_max_file, write_pdf, Config};
use std::path::Path;
let pages = decode_max_file("scan.max", &Config::default())?;
write_pdf(&pages, Path::new("scan.pdf"))?;§Format documentation
See docs/format.md and docs/decoder.md in the repo for the format
specification and the canonical decoder behaviour.
§Output bitmap polarity
Page::bitmap is 1-bit packed, MSB-first per byte. Bit value 1
means BLACK. This matches the PDF /Indexed [/DeviceGray 1 <FF 00>]
convention used by write_pdf. If you’re comparing against a PNG
ground-truth in PIL '1' mode, be aware that PIL '1' uses the
opposite convention (bit 1 = white) — invert before comparing.
Structs§
- Config
- Decoder configuration.
- Config
Builder - Fluent builder for
Config. - Decode
Stats - Per-page decoder statistics. Soft-error counters live here, not in
MaxError. - Page
- A single decoded page.
- PdfOptions
- Configuration for PDF generation.
- Preview
- Embedded preview thumbnail, decoded and (optionally) upscaled to match the main image’s pixel dimensions.
Enums§
- Dispatch
Kind - Per-line dispatch outcome kinds (used by
t0_drop_kindsfilter). - MaxError
- Errors returned by the .max decoder.
- T0Drop
Mode - Behaviour for the type-0 marker
t0_drop_after_driftheuristic.
Constants§
- MAX_
IMAGE_ PIXELS - Maximum supported pixel count for the main image (
width * height). - MAX_
PREVIEW_ PIXELS - Maximum supported pixel count for the intermediate preview buffer
(
padded_x * preview_height).
Functions§
- decode_
max - Decode all image chunks in a
.maxbyte buffer. - decode_
max_ file - Decode a
.maxfile from disk. Convenience wrapper fordecode_max. - write_
pdf - Write
pagestopathas a single PDF. Convenience wrapper forwrite_pdf_bytes. - write_
pdf_ bytes - Build a PDF as a
Vec<u8>.
Type Aliases§
- Result
- Convenience alias:
Result<T, MaxError>.