imagescript 1.2.9 → 1.2.16
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/ImageScript.d.ts +223 -0
- package/ImageScript.js +1646 -1682
- package/LICENSE +619 -0
- package/README.md +46 -45
- package/bench/_.mjs +166 -0
- package/bench/all.mjs +4 -0
- package/bench/blur.mjs +59 -0
- package/bench/flip.mjs +63 -0
- package/bench/overlay.mjs +35 -0
- package/bench/package.json +7 -0
- package/bench/readme.md +64 -0
- package/bench/resize.mjs +52 -0
- package/codecs/LICENSE +21 -0
- package/codecs/lib.d.ts +50 -0
- package/codecs/lib.js +6 -0
- package/codecs/lib.mjs +1 -0
- package/codecs/node/bin/arm64-darwin.node +0 -0
- package/{node → codecs/node/bin}/arm64-linux.node +0 -0
- package/codecs/node/bin/x64-darwin.node +0 -0
- package/{node → codecs/node/bin}/x64-linux.node +0 -0
- package/{node → codecs/node/bin}/x64-win32.node +0 -0
- package/codecs/node/index.js +3 -0
- package/codecs/node/index.mjs +6 -0
- package/codecs/package.json +14 -0
- package/codecs/readme.md +38 -0
- package/{wasm/simd.wasm → codecs/tests/gif.js} +0 -0
- package/{wasm/unknown.wasm → codecs/tests/jpeg.js} +0 -0
- package/codecs/tests/png.js +0 -0
- package/codecs/tests/results/gif/1024.nis.gif +0 -0
- package/codecs/tests/results/gif/1024.skyra.gif +0 -0
- package/codecs/tests/results/gif/256.nis.gif +0 -0
- package/codecs/tests/results/gif/256.skyra.gif +0 -0
- package/codecs/tests/results/jpeg/256.jpegjs.jpeg +0 -0
- package/codecs/tests/results/jpeg/256.nis.jpeg +0 -0
- package/codecs/tests/results/jpeg/256.sharp.jpeg +0 -0
- package/codecs/tests/results/jpeg/512.jpegjs.jpeg +0 -0
- package/codecs/tests/results/jpeg/512.nis.jpeg +0 -0
- package/codecs/tests/results/jpeg/512.sharp.jpeg +0 -0
- package/codecs/tests/results/jpeg/64.jpegjs.jpeg +0 -0
- package/codecs/tests/results/jpeg/64.nis.jpeg +0 -0
- package/codecs/tests/results/jpeg/64.sharp.jpeg +0 -0
- package/codecs/tests/results/png/256.jis.png +0 -0
- package/codecs/tests/results/png/256.nis.png +0 -0
- package/codecs/tests/results/png/256.sharp.png +0 -0
- package/codecs/tests/results/png/256.upng.png +0 -0
- package/codecs/tests/results/png/512.jis.png +0 -0
- package/codecs/tests/results/png/512.nis.png +0 -0
- package/codecs/tests/results/png/512.sharp.png +0 -0
- package/codecs/tests/results/png/512.upng.png +0 -0
- package/codecs/tests/results/png/64.jis.png +0 -0
- package/codecs/tests/results/png/64.nis.png +0 -0
- package/codecs/tests/results/png/64.sharp.png +0 -0
- package/codecs/tests/results/png/64.upng.png +0 -0
- package/codecs/tests/webp.js +0 -0
- package/codecs/wasm/bin/codecs.wasm +0 -0
- package/codecs/wasm/bin/simd.wasm +0 -0
- package/codecs/wasm/bundle/browser.js +1 -0
- package/codecs/wasm/index.js +1 -0
- package/codecs/wasm/index.mjs +1 -0
- package/package.json +41 -28
- package/png/node.js +1137 -1137
- package/png/src/{crc.js → crc.mjs} +48 -48
- package/png/src/{mem.js → mem.mjs} +23 -23
- package/png/src/{png.js → png.mjs} +254 -254
- package/png/src/{zlib.js → zlib.mjs} +617 -617
- package/tsconfig.json +21 -0
- package/utils/mem.js +25 -25
- package/v2/codecs/magic.js +24 -24
- package/v2/framebuffer.d.ts +66 -66
- package/v2/framebuffer.js +2352 -2371
- package/v2/framebuffer.mjs +125 -125
- package/v2/framebuffer.rs +1264 -0
- package/v2/index.d.ts +83 -83
- package/v2/index.js +260 -260
- package/v2/ops/{blur.js → blur.mjs} +302 -302
- package/v2/ops/{color.js → color.mjs} +276 -276
- package/v2/ops/{crop.js → crop.mjs} +63 -63
- package/v2/ops/{fill.js → fill.mjs} +32 -32
- package/v2/ops/{flip.js → flip.mjs} +32 -32
- package/v2/ops/index.mjs +9 -0
- package/v2/ops/{iterator.js → iterator.mjs} +33 -33
- package/v2/ops/overlay.mjs +63 -0
- package/v2/ops/{resize.js → resize.mjs} +165 -165
- package/v2/ops/{rotate.js → rotate.mjs} +116 -117
- package/v2/util/{mem.js → mem.mjs} +24 -26
- package/wasm/any/font.wasm +0 -0
- package/wasm/any/png.wasm +0 -0
- package/wasm/node/font.js +141 -141
- package/wasm/node/gif.js +76 -76
- package/wasm/node/jpeg.js +91 -91
- package/wasm/node/png.js +49 -0
- package/wasm/node/svg.js +55 -55
- package/wasm/node/tiff.js +46 -46
- package/node/arm64-darwin.node +0 -0
- package/node/index.js +0 -7
- package/node/x64-darwin.node +0 -0
- package/v2/ops/index.js +0 -9
- package/v2/ops/overlay.js +0 -56
- package/wasm/node.js +0 -23
- package/wasm/web.js +0 -10
package/v2/index.d.ts
CHANGED
|
@@ -1,84 +1,84 @@
|
|
|
1
|
-
import { Color } from './framebuffer';
|
|
2
|
-
import type framebuffer from './framebuffer';
|
|
3
|
-
|
|
4
|
-
export { Color };
|
|
5
|
-
export function load(buffer: BufferSource): Image | Animation;
|
|
6
|
-
|
|
7
|
-
type svg_options = {
|
|
8
|
-
/** image fit options */
|
|
9
|
-
fit?: svg_fit_zoom | svg_fit_width | svg_fit_height,
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
type png_options = {
|
|
13
|
-
compression?: 'fast' | 'best' | 'default',
|
|
14
|
-
filter?: 'up' | 'sub' | 'none' | 'paeth' | 'average',
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
type svg_fit_zoom = {
|
|
18
|
-
/** zoom by factor */
|
|
19
|
-
zoom: number,
|
|
20
|
-
width?: undefined,
|
|
21
|
-
height?: undefined,
|
|
22
|
-
};
|
|
23
|
-
type svg_fit_width = {
|
|
24
|
-
/** scale to width */
|
|
25
|
-
width: number,
|
|
26
|
-
zoom?: undefined,
|
|
27
|
-
height?: undefined,
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
type svg_fit_height = {
|
|
31
|
-
/** scale to height */
|
|
32
|
-
height: number,
|
|
33
|
-
zoom?: undefined,
|
|
34
|
-
width?: undefined,
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
export class Frame {
|
|
38
|
-
image: Image;
|
|
39
|
-
timestamp: number;
|
|
40
|
-
dispose: 'any' | 'keep' | 'previous' | 'background';
|
|
41
|
-
|
|
42
|
-
constructor(width: number, height: number, buffer?: Image | BufferSource);
|
|
43
|
-
static from(framebuffer: { width: number, height: number, u8?: BufferSource, timestamp?: number, buffer?: BufferSource, dispose: 'any' | 'keep' | 'previous' | 'background' }): Frame;
|
|
44
|
-
|
|
45
|
-
clone(): this;
|
|
46
|
-
get width(): number;
|
|
47
|
-
get height(): number;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
// @ts-ignore
|
|
51
|
-
export class Image extends framebuffer {
|
|
52
|
-
clone(): this;
|
|
53
|
-
static from(framebuffer: { width: number, height: number, u8?: BufferSource, buffer?: BufferSource }): Image;
|
|
54
|
-
|
|
55
|
-
encode(format: 'png', options?: png_options): Promise<Uint8Array>;
|
|
56
|
-
encode(format: 'png', options: png_options & { sync: true }): Uint8Array;
|
|
57
|
-
encode(format: 'jpeg', options?: { quality?: number }): Promise<Uint8Array>;
|
|
58
|
-
encode(format: 'webp', options?: { quality?: number }): Promise<Uint8Array>;
|
|
59
|
-
encode(format: 'jpeg', options: { quality?: number } & { sync: true }): Uint8Array;
|
|
60
|
-
encode(format: 'webp', options: { quality?: number } & { sync: true }): Uint8Array;
|
|
61
|
-
|
|
62
|
-
static decode(format: 'png', buffer: BufferSource): Promise<Image>;
|
|
63
|
-
static decode(format: 'jpeg', buffer: BufferSource): Promise<Image>;
|
|
64
|
-
static decode(format: 'tiff', buffer: BufferSource): Promise<Image>;
|
|
65
|
-
static decode(format: 'auto', buffer: string | BufferSource, options?: any): Promise<Image>;
|
|
66
|
-
static decode(format: 'svg', buffer: string | BufferSource, options?: svg_options): Promise<Image>;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
export class Animation {
|
|
70
|
-
repeat: number;
|
|
71
|
-
readonly width: number;
|
|
72
|
-
readonly height: number;
|
|
73
|
-
readonly frames: Frame[];
|
|
74
|
-
|
|
75
|
-
constructor(width: number, height: number);
|
|
76
|
-
static decode(format: 'gif', buffer: BufferSource, options?: {}): Promise<Animation>;
|
|
77
|
-
static decode(format: 'auto', buffer: BufferSource, options?: any): Promise<Animation>;
|
|
78
|
-
|
|
79
|
-
clear(): void;
|
|
80
|
-
add(frame: Frame): void;
|
|
81
|
-
[Symbol.iterator]: Generator<Frame, Frame>;
|
|
82
|
-
resize(type: 'cubic' | 'linear' | 'nearest', width: number, height: number): void;
|
|
83
|
-
encode(format: 'gif', options?: { repeat?: number, comment?: string, application?: string }): Promise<Uint8Array>;
|
|
1
|
+
import { Color } from './framebuffer';
|
|
2
|
+
import type framebuffer from './framebuffer';
|
|
3
|
+
|
|
4
|
+
export { Color };
|
|
5
|
+
export function load(buffer: BufferSource): Image | Animation;
|
|
6
|
+
|
|
7
|
+
type svg_options = {
|
|
8
|
+
/** image fit options */
|
|
9
|
+
fit?: svg_fit_zoom | svg_fit_width | svg_fit_height,
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
type png_options = {
|
|
13
|
+
compression?: 'fast' | 'best' | 'default',
|
|
14
|
+
filter?: 'up' | 'sub' | 'none' | 'paeth' | 'average',
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
type svg_fit_zoom = {
|
|
18
|
+
/** zoom by factor */
|
|
19
|
+
zoom: number,
|
|
20
|
+
width?: undefined,
|
|
21
|
+
height?: undefined,
|
|
22
|
+
};
|
|
23
|
+
type svg_fit_width = {
|
|
24
|
+
/** scale to width */
|
|
25
|
+
width: number,
|
|
26
|
+
zoom?: undefined,
|
|
27
|
+
height?: undefined,
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
type svg_fit_height = {
|
|
31
|
+
/** scale to height */
|
|
32
|
+
height: number,
|
|
33
|
+
zoom?: undefined,
|
|
34
|
+
width?: undefined,
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
export class Frame {
|
|
38
|
+
image: Image;
|
|
39
|
+
timestamp: number;
|
|
40
|
+
dispose: 'any' | 'keep' | 'previous' | 'background';
|
|
41
|
+
|
|
42
|
+
constructor(width: number, height: number, buffer?: Image | BufferSource);
|
|
43
|
+
static from(framebuffer: { width: number, height: number, u8?: BufferSource, timestamp?: number, buffer?: BufferSource, dispose: 'any' | 'keep' | 'previous' | 'background' }): Frame;
|
|
44
|
+
|
|
45
|
+
clone(): this;
|
|
46
|
+
get width(): number;
|
|
47
|
+
get height(): number;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
// @ts-ignore
|
|
51
|
+
export class Image extends framebuffer {
|
|
52
|
+
clone(): this;
|
|
53
|
+
static from(framebuffer: { width: number, height: number, u8?: BufferSource, buffer?: BufferSource }): Image;
|
|
54
|
+
|
|
55
|
+
encode(format: 'png', options?: png_options): Promise<Uint8Array>;
|
|
56
|
+
encode(format: 'png', options: png_options & { sync: true }): Uint8Array;
|
|
57
|
+
encode(format: 'jpeg', options?: { quality?: number }): Promise<Uint8Array>;
|
|
58
|
+
encode(format: 'webp', options?: { quality?: number }): Promise<Uint8Array>;
|
|
59
|
+
encode(format: 'jpeg', options: { quality?: number } & { sync: true }): Uint8Array;
|
|
60
|
+
encode(format: 'webp', options: { quality?: number } & { sync: true }): Uint8Array;
|
|
61
|
+
|
|
62
|
+
static decode(format: 'png', buffer: BufferSource): Promise<Image>;
|
|
63
|
+
static decode(format: 'jpeg', buffer: BufferSource): Promise<Image>;
|
|
64
|
+
static decode(format: 'tiff', buffer: BufferSource): Promise<Image>;
|
|
65
|
+
static decode(format: 'auto', buffer: string | BufferSource, options?: any): Promise<Image>;
|
|
66
|
+
static decode(format: 'svg', buffer: string | BufferSource, options?: svg_options): Promise<Image>;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export class Animation {
|
|
70
|
+
repeat: number;
|
|
71
|
+
readonly width: number;
|
|
72
|
+
readonly height: number;
|
|
73
|
+
readonly frames: Frame[];
|
|
74
|
+
|
|
75
|
+
constructor(width: number, height: number);
|
|
76
|
+
static decode(format: 'gif', buffer: BufferSource, options?: {}): Promise<Animation>;
|
|
77
|
+
static decode(format: 'auto', buffer: BufferSource, options?: any): Promise<Animation>;
|
|
78
|
+
|
|
79
|
+
clear(): void;
|
|
80
|
+
add(frame: Frame): void;
|
|
81
|
+
[Symbol.iterator]: Generator<Frame, Frame>;
|
|
82
|
+
resize(type: 'cubic' | 'linear' | 'nearest', width: number, height: number): void;
|
|
83
|
+
encode(format: 'gif', options?: { repeat?: number, comment?: string, application?: string }): Promise<Uint8Array>;
|
|
84
84
|
}
|