-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.d.ts
53 lines (49 loc) · 1.75 KB
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
/** Constant used in PNG encoding methods. */
export const PNG_NO_FILTERS: number;
/** Constant used in PNG encoding methods. */
export const PNG_ALL_FILTERS: number;
/** Constant used in PNG encoding methods. */
export const PNG_FILTER_NONE: number;
/** Constant used in PNG encoding methods. */
export const PNG_FILTER_SUB: number;
/** Constant used in PNG encoding methods. */
export const PNG_FILTER_UP: number;
/** Constant used in PNG encoding methods. */
export const PNG_FILTER_AVG: number;
/** Constant used in PNG encoding methods. */
export const PNG_FILTER_PAETH: number;
export interface PngConfig {
/** Specifies the ZLIB compression level. Defaults to 6. */
compressionLevel?: 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9;
/**
* Any bitwise combination of `PNG_FILTER_NONE`, `PNG_FITLER_SUB`,
* `PNG_FILTER_UP`, `PNG_FILTER_AVG` and `PNG_FILTER_PATETH`; or one of
* `PNG_ALL_FILTERS` or `PNG_NO_FILTERS`.
* These specify which filters *may* be used by libpng. During
* encoding, libpng will select the best filter from this list of allowed
* filters. Defaults to `PNG_ALL_FITLERS`.
*/
filters?: number;
/**
* _For creating indexed PNGs._ The palette of colors. Entries should be in
* RGBA order.
*/
palette?: Uint8ClampedArray;
/**
* _For creating indexed PNGs._ The index of the background color. Defaults
* to 0.
*/
backgroundIndex?: number;
/** pixels per inch */
resolution?: number;
}
export interface DecodedImageData {
width: number;
height: number;
data: Buffer;
}
export interface DecodeOptions {
premultiplied: boolean;
}
export function encodePNG(width: number, height: number, data: Buffer, options?: PngConfig): Promise<Buffer>;
export function decodePNG(data: Buffer, options?: DecodeOptions): Promise<DecodedImageData>;