@alttiri/image-hash
Version:
Alt-Image-Hash. An alternative image hashing library.
29 lines (28 loc) • 1.19 kB
TypeScript
import { BiImageData } from "./mono-image-data.js";
export declare class ImageHash {
readonly mono: BiImageData;
private constructor();
static fromMono(mono: BiImageData): ImageHash;
getMono(copy?: boolean): BiImageData;
static fromHex(hexLine: string, width?: number, height?: number): ImageHash;
static fromBin(binLine: string, width?: number, height?: number): ImageHash;
private static from;
/** Bits size */
get size(): number;
get hex(): string;
get bin(): string;
diff(hash: ImageHash): number;
diffHex(hex: string): number;
diffBin(bin: string): number;
static diffHex(hex1: string, hex2: string): number;
static diffBin(bin1: string, bin2: string): number;
}
export declare function calculateSquareSize(pixelCount: number): {
width: number;
height: number;
};
export declare function hexToBiUi8a(hex: string): Uint8Array;
export declare function binToBiUi8a(bin: string): Uint8Array;
export declare function biUi8aToHex(biUi8a: Uint8Array): string;
export declare function biUi8aToBin(biUi8a: Uint8Array): string;
export declare function hammingDistanceBiUi8a(arr1: Uint8Array, arr2: Uint8Array): number;