UNPKG

@forgesworn/qr

Version:

Dependency-free QR code encoder and decoder for TypeScript, browsers, workers and Node, with optional WebAssembly and tracked camera scanning.

23 lines (22 loc) • 962 B
/** Pixels to read: RGBA (4 bytes a pixel, as ImageData gives) or greyscale (1 byte a pixel). */ export interface ImageLike { readonly data: Uint8Array | Uint8ClampedArray; readonly width: number; readonly height: number; } export interface DecodeOptions { /** Pixels from the start of one row to the next, for padded camera planes. Default: width. */ readonly rowStride?: number; /** Bytes a pixel. Default: worked out from the data length. */ readonly channels?: 1 | 4; /** Which way round to look for dark modules. Default 'both': dark on light first, then light on dark. */ readonly inversion?: 'normal' | 'inverted' | 'both'; } /** Validates the complete input before a session considers a smaller region. */ export declare function imageLayout(image: ImageLike, options?: DecodeOptions): { width: number; height: number; stride: number; channels: 1 | 4; inversion: "normal" | "inverted" | "both"; };