histoire
Version:
A fast story book powered by Vite
40 lines • 1.41 kB
TypeScript
import { Buffer } from 'node:buffer';
/** Validate PNG chunk structure and capture limits without decoding pixels. */
export declare function readVisualPngDimensions(bytes: Uint8Array): {
width: number;
height: number;
};
/** Decode bounded PNGs before allocating buffers from untrusted dimensions. */
export declare function decodeVisualPng(bytes: Uint8Array): Promise<import("pngjs").PNGWithMetadata>;
/** Compare actual decoded pixels; encoding changes cannot produce false regressions. */
export declare function compareVisualImages(baseline: Uint8Array, current: Uint8Array, policy: {
threshold: number;
includeAA: boolean;
maxDiffPixelRatio: number;
}): Promise<{
baselineDimensions: {
width: number;
height: number;
};
currentDimensions: {
width: number;
height: number;
};
status: 'incompatible';
} | {
baselineDimensions: {
width: number;
height: number;
};
currentDimensions: {
width: number;
height: number;
};
status: "changed" | "passed";
diffPixels: number;
diffPixelRatio: number;
diff: Buffer<ArrayBufferLike>;
}>;
/** Strict identity ignoring PNG encoding: same dimensions and same RGBA bytes, no tolerance. */
export declare function visualPixelsIdentical(baseline: Uint8Array, current: Uint8Array): Promise<boolean>;
//# sourceMappingURL=compare.d.ts.map