jimp 0.2.24 → 0.2.28

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/jimp.d.ts ADDED
@@ -0,0 +1,133 @@
1
+
2
+ declare namespace Jimp {
3
+ type ImageCallback = (err: Error|null, image: Jimp) => any;
4
+
5
+ interface RGB {
6
+ r: number;
7
+ g: number;
8
+ b: number;
9
+ }
10
+ interface RGBA {
11
+ r: number;
12
+ g: number;
13
+ b: number;
14
+ a: number;
15
+ }
16
+
17
+ interface Jimp {
18
+ bitmap: {data: Buffer, width: number, height: number};
19
+
20
+ clone(cb?: Jimp.ImageCallback): Jimp;
21
+ quality(n: number, cb?: Jimp.ImageCallback): this;
22
+ deflateLevel(l: number, cb?: Jimp.ImageCallback): this;
23
+ deflateStrategy(s: number, cb?: Jimp.ImageCallback): this;
24
+ filterType(f: number, cb?: Jimp.ImageCallback): this;
25
+
26
+ rgba(bool: boolean, cb?: Jimp.ImageCallback): this;
27
+ background(hex: number, cb?: Jimp.ImageCallback): this;
28
+ scan(x: number, y: number, w: number, h: number, f: (x:number, y:number, idx:number)=>any, cb?: Jimp.ImageCallback): this;
29
+ getMIME(): string;
30
+ getExtension(): string;
31
+ getPixelIndex(x: number, y: number, cb?: (err:Error, i:number)=>any): number;
32
+ getPixelColor(x: number, y: number, cb?: (err:Error, hex:number)=>any): number;
33
+ setPixelColor(hex: number, x: number, y: number, cb?: Jimp.ImageCallback): this;
34
+ hash(base?: number, cb?: (err:Error, hash: string)=>any): string;
35
+ crop(x: number, y: number, w: number, h: number, cb?: Jimp.ImageCallback): this;
36
+ autocrop(tolerance?: number, cropOnlyFrames?: boolean, cb?: Jimp.ImageCallback): this
37
+ blit(src: Jimp, x: number, y: number, srcx?: number, srcy?: number, srcw?: number, srch?: number, cb?: Jimp.ImageCallback): this
38
+ mask(src: Jimp, x: number, y: number, cb?: Jimp.ImageCallback): this
39
+ composite(src: Jimp, x: number, y: number, cb?: Jimp.ImageCallback): this;
40
+ brightness(val: number, cb?: Jimp.ImageCallback): this;
41
+ contrast(val: number, cb?: Jimp.ImageCallback): this;
42
+ posterize(n: number, cb?: Jimp.ImageCallback): this;
43
+ histogram(): {r: number[], g: number[], b: number[]};
44
+ normalize(cb?: Jimp.ImageCallback): this;
45
+ invert(cb?: Jimp.ImageCallback): this;
46
+ mirror(horizontal: boolean, vertical: boolean, cb?: Jimp.ImageCallback): this;
47
+ gaussian(r: number, cb?: Jimp.ImageCallback): this;
48
+ blur(r: number, cb?: Jimp.ImageCallback): this;
49
+
50
+ greyscale(cb?: Jimp.ImageCallback): this;
51
+ grayscale(cb?: Jimp.ImageCallback): this;
52
+ sepia(cb?: Jimp.ImageCallback): this;
53
+ opacity(f: any, cb?: any):this;
54
+ fade(f: any, cb?: any): this;
55
+ opaque(cb: any): this;
56
+ resize(w: number, h: number, mode?: string, cb?: Jimp.ImageCallback): this;
57
+ cover(w: number, h: number, alignBits?: number, mode?: string, cb?: Jimp.ImageCallback): this;
58
+ contain(w: number, h: number, alignBits?: number, mode?: string, cb?: Jimp.ImageCallback): this;
59
+ scale(f: number, mode?: string, cb?: Jimp.ImageCallback): this;
60
+ scaleToFit(w: number, h: number, mode?: any, cb?: Jimp.ImageCallback): this;
61
+ rotate(deg: number, mode?: number|boolean, cb?: Jimp.ImageCallback): this;
62
+ getBuffer(mime: string, cb:(err:Error, buffer:Buffer)=>any): this;
63
+
64
+ write(path: string, cb?: Jimp.ImageCallback): this;
65
+ }
66
+
67
+ var Jimp: {
68
+
69
+ // used to auto resizing etc.
70
+ AUTO: number;
71
+
72
+ // supported mime types
73
+ MIME_PNG: string;
74
+ MIME_JPEG: string;
75
+ MIME_BMP: string;
76
+
77
+ // PNG filter types
78
+ PNG_FILTER_AUTO: number;
79
+ PNG_FILTER_NONE: number;
80
+ PNG_FILTER_SUB: number;
81
+ PNG_FILTER_UP: number;
82
+ PNG_FILTER_AVERAGE: number;
83
+ PNG_FILTER_PAETH: number;
84
+
85
+ // resize methods
86
+ RESIZE_NEAREST_NEIGHBOR: string;
87
+ RESIZE_BILINEAR: string;
88
+ RESIZE_BICUBIC: string;
89
+ RESIZE_HERMITE: string;
90
+ RESIZE_BEZIER: string;
91
+
92
+ // Align modes for cover, contain, bit masks
93
+ HORIZONTAL_ALIGN_LEFT: number;
94
+ HORIZONTAL_ALIGN_CENTER: number;
95
+ HORIZONTAL_ALIGN_RIGHT: number;
96
+
97
+ VERTICAL_ALIGN_TOP: number;
98
+ VERTICAL_ALIGN_MIDDLE: number;
99
+ VERTICAL_ALIGN_BOTTOM: number;
100
+
101
+ // Font locations
102
+ FONT_SANS_8_BLACK: string;
103
+ FONT_SANS_16_BLACK: string;
104
+ FONT_SANS_32_BLACK: string;
105
+ FONT_SANS_64_BLACK: string;
106
+ FONT_SANS_128_BLACK: string;
107
+
108
+ FONT_SANS_8_WHITE: string;
109
+ FONT_SANS_16_WHITE: string;
110
+ FONT_SANS_32_WHITE: string;
111
+ FONT_SANS_64_WHITE: string;
112
+ FONT_SANS_128_WHITE: string;
113
+
114
+ (path: string, cb?: Jimp.ImageCallback): Jimp;
115
+ (image: Jimp, cb?: Jimp.ImageCallback): Jimp;
116
+ (data: Buffer, cb?: Jimp.ImageCallback): Jimp;
117
+ (w: number, h: number, cb?: Jimp.ImageCallback): Jimp;
118
+
119
+ read(src: string|Buffer, cb?: Jimp.ImageCallback): Promise<Jimp>;
120
+
121
+ rgbaToInt(r: number, g: number, b: number, a: number, cb?: (err: Error, i: number)=>any): number;
122
+ intToRgba(i: number, cb?: (err:Error, rgba: Jimp.RGBA)=>any): Jimp.RGBA;
123
+ limit255(n: number): number;
124
+ diff(img1: Jimp, img2: Jimp, threshold?: number): {percent: number, diff: Jimp};
125
+ distance(img1: Jimp, img2: Jimp): number;
126
+
127
+ prototype: Jimp;
128
+ };
129
+ }
130
+
131
+ declare module "jimp" {
132
+ export = Jimp.Jimp;
133
+ }