Interface VisionPreprocessingConfig

Preprocessing options applied to images before they enter the vision pipeline tiers. Uses sharp under the hood.

interface VisionPreprocessingConfig {
    grayscale?: boolean;
    resize?: {
        maxWidth?: number;
        maxHeight?: number;
    };
    sharpen?: boolean;
    normalize?: boolean;
}

Properties

grayscale?: boolean

Convert to grayscale before OCR (improves contrast for printed text).

resize?: {
    maxWidth?: number;
    maxHeight?: number;
}

Resize constraints. The image is scaled down proportionally so that neither dimension exceeds the specified maximum. No upscaling is performed.

Type declaration

  • Optional maxWidth?: number
  • Optional maxHeight?: number
sharpen?: boolean

Apply unsharp-mask sharpening (helps blurry scans).

normalize?: boolean

Normalize brightness/contrast (histogram stretching).