import { ImageDataLike, WasmSource } from "./common.js"; export interface QuantizeOptions { /** * Range: [1, 10], bigger is faster and generate images of lower quality, * but may be useful for real-time generation of images. * * @default 4 */ speed?: number; /** * Range [0, 100], roughly like JPEG. the max 100 means best effort * If less than 100, the library will try to use fewer colors. * * Images with fewer colors are not always smaller, due to increased dithering it causes. * * @default 75 */ quality?: number; /** * Limit the number of colors in palette, range: [2, 256]. * * @default 256 */ colors?: number; /** * Range [0, 1] float, set to 1 to get nice smooth image. * * @default 1 */ dithering?: number; } export interface Options extends QuantizeOptions { /** * Range [0, 6], bigger means smallest file and slower compression. * * @default 3 */ level?: number; /** * Is the image made to support progressive loading? * Enabling this feature will increase the size of the results. * * @default false */ interlace?: boolean; /** * Lossy compress the image to PNG for significant file size reduction. * Implements the same functionality as [pngquant](https://pngquant.org) * * if set to false, properties from `QuantizeOptions` are ignored. * * @default true */ quantize?: boolean; /** @internal */ bit_depth?: number; } export declare const defaultOptions: Required; export declare const bitDepth: number[]; export declare const mimeType = "image/png"; export declare const extension = "png"; export declare const loadEncoder: (module_or_path?: WasmSource) => Promise; export declare const loadDecoder: (module_or_path?: WasmSource) => Promise; /** * Reduces the colors used in the image at a slight loss, using a combination * of vector quantization algorithms. * * Can be used before other compression algorithm to boost compression ratio. */ export declare function reduceColors(image: ImageDataLike, options?: QuantizeOptions): Uint8Array; export declare function encode(image: ImageDataLike, options?: Options): Uint8Array; export declare function decode(input: Uint8Array): ImageDataLike;