Skip to main content

Crate vigb_decoder

Crate vigb_decoder 

Source
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.
ConfigBuilder
Fluent builder for Config.
DecodeStats
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§

DispatchKind
Per-line dispatch outcome kinds (used by t0_drop_kinds filter).
MaxError
Errors returned by the .max decoder.
T0DropMode
Behaviour for the type-0 marker t0_drop_after_drift heuristic.

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 .max byte buffer.
decode_max_file
Decode a .max file from disk. Convenience wrapper for decode_max.
write_pdf
Write pages to path as a single PDF. Convenience wrapper for write_pdf_bytes.
write_pdf_bytes
Build a PDF as a Vec<u8>.

Type Aliases§

Result
Convenience alias: Result<T, MaxError>.