/// export interface EncodeOptions { /** * The width of the image to be encoded in pixels. */ width: number; /** * The height of the image to be encoded in pixels. */ height?: number; /** * level of compression to use 0 - no compression, 1 - fastest, 9 - best size. */ compressionLevel?: 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9; } /** * Encode a buffer of raw RGB or RGBA image data into PNG format. * Only RGB and RGBA color formats are supported. This function will automatically calculate whether an * alpha channel is present by calculating the amount of bytes per pixel from the length of the buffer * and the provided `width` and `height`. Only 8bit colors are supported. * * @param buffer The buffer of raw pixel data to encode. * @param options Options used to encode the image. * * @return the encoded PNG as a new buffer. */ export declare function encode(buffer: Buffer, options: EncodeOptions): Buffer; export declare type WritePngFileCallback = (error: Error) => void; export declare function writePngFile(path: string, buffer: Buffer, options: EncodeOptions, callback: WritePngFileCallback): void; export declare function writePngFile(path: string, buffer: Buffer, options: EncodeOptions): Promise; /** * Encode and write a PNG file synchroneously. * * @param path The path the file should be written to. * @param buffer The buffer of raw pixel data which should be encoded and written to disk. * @param options Options used to encode the image. * * @return The decoded image. */ export declare function writePngFileSync(path: string, buffer: Buffer, options: EncodeOptions): void;