jimp 1.3.0 → 1.6.0

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/README.md ADDED
@@ -0,0 +1,41 @@
1
+ <div align="center">
2
+ <img width="200" height="200"
3
+ src="https://s3.amazonaws.com/pix.iemoji.com/images/emoji/apple/ios-11/256/crayon.png">
4
+ <h1>Jimp</h1>
5
+ <p>JavaScript Image Manipulation Program</p>
6
+ </div>
7
+
8
+ The "JavaScript Image Manipulation Program" :-)
9
+
10
+ An image processing library for Node written entirely in JavaScript, with zero native dependencies.
11
+
12
+ The default jimp configuration.
13
+
14
+ Supported types:
15
+
16
+ - `@jimp/jpeg`
17
+ - `@jimp/png`
18
+ - `@jimp/bmp`
19
+ - `@jimp/tiff`
20
+ - `@jimp/gif`
21
+
22
+ [Read the full docs.](http://jimp-dev.github.io/jimp/)
23
+
24
+ ## Installation
25
+
26
+ ```bash
27
+ npm install --save jimp
28
+ ```
29
+
30
+ ## Usage
31
+
32
+ ```js
33
+ const { Jimp } = require("jimp");
34
+
35
+ // open a file called "lenna.png"
36
+ const image = await Jimp.read("test.png");
37
+
38
+ image.resize(256, 256); // resize
39
+
40
+ await image.write("test-small.jpg"); // save
41
+ ```
@@ -32,6 +32,7 @@ import * as flip from '@jimp/plugin-flip';
32
32
  export { FlipOptions } from '@jimp/plugin-flip';
33
33
  import * as mask from '@jimp/plugin-mask';
34
34
  import * as print from '@jimp/plugin-print';
35
+ export { measureText, measureTextHeight } from '@jimp/plugin-print';
35
36
  import * as resize from '@jimp/plugin-resize';
36
37
  export { ResizeOptions, ResizeStrategy, ScaleOptions, ScaleToFitOptions } from '@jimp/plugin-resize';
37
38
  import * as rotate from '@jimp/plugin-rotate';
@@ -117,6 +118,14 @@ declare const defaultPlugins: ({
117
118
  quantize<I extends _jimp_types.JimpClass>(image: I, options: quantize.QuantizeOptions): I;
118
119
  })[];
119
120
  declare const defaultFormats: (typeof _jimp_js_bmp__default | typeof msBmp | typeof gif | typeof _jimp_js_jpeg__default | typeof _jimp_js_png__default | typeof tiff)[];
121
+ /** Convenience object for getting the MIME types of the default formats */
122
+ declare const JimpMime: {
123
+ bmp: "image/bmp";
124
+ gif: "image/gif";
125
+ jpeg: "image/jpeg";
126
+ png: "image/png";
127
+ tiff: "image/tiff";
128
+ };
120
129
  /**
121
130
  * @class
122
131
  *
@@ -337,7 +346,7 @@ declare const Jimp: {
337
346
  image: any;
338
347
  }, void, unknown>;
339
348
  };
340
- read(url: string): Promise<{
349
+ read(url: string | Buffer | ArrayBuffer, options?: Record<"image/tiff", Record<string, any> | undefined> | Record<"image/gif", Record<string, any> | undefined> | Record<"image/bmp", _jimp_js_bmp.DecodeBmpOptions> | Record<"image/x-ms-bmp", _jimp_js_bmp.DecodeBmpOptions> | Record<"image/jpeg", _jimp_js_jpeg.DecodeJpegOptions> | Record<"image/png", _jimp_js_png.DecodePngOptions> | undefined): Promise<{
341
350
  bitmap: _jimp_types.Bitmap;
342
351
  background: number;
343
352
  formats: _jimp_types.Format<any>[];
@@ -933,7 +942,7 @@ declare const Jimp: {
933
942
  } & {
934
943
  quantize<I extends _jimp_types.JimpClass>(image: I, options: quantize.QuantizeOptions): I;
935
944
  }>;
936
- fromBuffer(buffer: Buffer | ArrayBuffer): Promise<{
945
+ fromBuffer(buffer: Buffer | ArrayBuffer, options?: Record<"image/tiff", Record<string, any> | undefined> | Record<"image/gif", Record<string, any> | undefined> | Record<"image/bmp", _jimp_js_bmp.DecodeBmpOptions> | Record<"image/x-ms-bmp", _jimp_js_bmp.DecodeBmpOptions> | Record<"image/jpeg", _jimp_js_jpeg.DecodeJpegOptions> | Record<"image/png", _jimp_js_png.DecodePngOptions> | undefined): Promise<{
937
946
  bitmap: _jimp_types.Bitmap;
938
947
  background: number;
939
948
  formats: _jimp_types.Format<any>[];
@@ -1440,7 +1449,7 @@ declare const Jimp: {
1440
1449
  }> ? T_11 extends Record<Mime, infer O> ? O : never : never : never)>(path: `${string}.${Extension}`, options?: Options | undefined): Promise<void>;
1441
1450
  clone<S extends {
1442
1451
  new (options?: _jimp_core.JimpConstructorOptions): any;
1443
- read(url: string): Promise<any & _jimp_core.JimpInstanceMethods<any, {
1452
+ read(url: string | Buffer | ArrayBuffer, options?: Record<"image/tiff", Record<string, any> | undefined> | Record<"image/gif", Record<string, any> | undefined> | Record<"image/bmp", _jimp_js_bmp.DecodeBmpOptions> | Record<"image/x-ms-bmp", _jimp_js_bmp.DecodeBmpOptions> | Record<"image/jpeg", _jimp_js_jpeg.DecodeJpegOptions> | Record<"image/png", _jimp_js_png.DecodePngOptions> | undefined): Promise<any & _jimp_core.JimpInstanceMethods<any, {
1444
1453
  blit<I extends _jimp_types.JimpClass>(image: I, options: blit.BlitOptions): I;
1445
1454
  } & {
1446
1455
  blur<I extends _jimp_types.JimpClass>(image: I, r: number): I;
@@ -1586,7 +1595,7 @@ declare const Jimp: {
1586
1595
  } & {
1587
1596
  quantize<I extends _jimp_types.JimpClass>(image: I, options: quantize.QuantizeOptions): I;
1588
1597
  }>;
1589
- fromBuffer(buffer: Buffer | ArrayBuffer): Promise<any & _jimp_core.JimpInstanceMethods<any, {
1598
+ fromBuffer(buffer: Buffer | ArrayBuffer, options?: Record<"image/tiff", Record<string, any> | undefined> | Record<"image/gif", Record<string, any> | undefined> | Record<"image/bmp", _jimp_js_bmp.DecodeBmpOptions> | Record<"image/x-ms-bmp", _jimp_js_bmp.DecodeBmpOptions> | Record<"image/jpeg", _jimp_js_jpeg.DecodeJpegOptions> | Record<"image/png", _jimp_js_png.DecodePngOptions> | undefined): Promise<any & _jimp_core.JimpInstanceMethods<any, {
1590
1599
  blit<I extends _jimp_types.JimpClass>(image: I, options: blit.BlitOptions): I;
1591
1600
  } & {
1592
1601
  blur<I extends _jimp_types.JimpClass>(image: I, r: number): I;
@@ -1750,5 +1759,6 @@ declare const Jimp: {
1750
1759
  } & {
1751
1760
  quantize<I extends _jimp_types.JimpClass>(image: I, options: quantize.QuantizeOptions): I;
1752
1761
  }>);
1762
+ type JimpInstance = InstanceType<typeof Jimp>;
1753
1763
 
1754
- export { Jimp, defaultFormats, defaultPlugins };
1764
+ export { Jimp, type JimpInstance, JimpMime, defaultFormats, defaultPlugins };