/** * Image header parsing: format sniffing and dimensions, with no decompression. * * Kept apart from the PNG codec so input validation, which runs on every request that carries an * image, loads only this and never the pixel decoder. Reading headers only is also what lets a * pixel ceiling stop a decompression bomb before anything is inflated. */ export type SniffedImageFormat = 'png' | 'jpeg' | 'gif' | 'webp' | 'avif' | 'bmp'; /** An image format recognised from its first bytes. */ export interface SniffedImage { /** The format. */ format: SniffedImageFormat; /** Its MIME type. */ mimeType: string; } /** Image dimensions read from a header. */ export interface ImageDimensionsInfo { /** Width in pixels. */ width: number; /** Height in pixels. */ height: number; } export declare const PNG_SIGNATURE: number[]; /** Identifies an image from its first bytes, ignoring whatever the caller claimed it was. */ export declare function sniffImageType(bytes: Uint8Array): SniffedImage | undefined; /** * Reads width and height from the header without decoding pixels. * * Returns `undefined` for a format it cannot measure, so a caller enforcing a pixel ceiling can * choose to refuse rather than decode blind. */ export declare function readImageDimensions(bytes: Uint8Array): ImageDimensionsInfo | undefined; /** @internal Byte helpers shared with the PNG codec. */ export declare function startsWith(bytes: Uint8Array, signature: readonly number[]): boolean; export declare function ascii(bytes: Uint8Array, offset: number, length: number): string; export declare function readUint32BE(bytes: Uint8Array, offset: number): number; export declare function readUint32LE(bytes: Uint8Array, offset: number): number; export declare function readInt32LE(bytes: Uint8Array, offset: number): number; export declare function readUint24LE(bytes: Uint8Array, offset: number): number; export declare function readUint16BE(bytes: Uint8Array, offset: number): number; export declare function readUint16LE(bytes: Uint8Array, offset: number): number;