@bit-blazer/libsquoosh 0.5.0 → 0.5.3
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 +167 -167
- package/build/auto-optimizer.d.ts +22 -22
- package/build/{avif_node_enc_mt-f295f4f0.js → avif_node_enc_mt-6963714a.js} +1 -1
- package/build/{avif_node_enc_mt.worker-4dc93f28.js → avif_node_enc_mt.worker-0dc727fb.js} +1 -1
- package/build/codecs.d.ts +221 -221
- package/build/emscripten-utils.d.ts +2 -2
- package/build/image_data.d.ts +6 -6
- package/build/index.d.ts +96 -96
- package/build/index.js +43 -43
- package/build/worker_pool.d.ts +23 -23
- package/package.json +44 -42
package/build/codecs.d.ts
CHANGED
|
@@ -1,222 +1,222 @@
|
|
|
1
|
-
interface DecodeModule extends EmscriptenWasm.Module {
|
|
2
|
-
decode: (data: Uint8Array) => ImageData;
|
|
3
|
-
}
|
|
4
|
-
interface ResizeInstantiateOptions {
|
|
5
|
-
width: number;
|
|
6
|
-
height: number;
|
|
7
|
-
method: string;
|
|
8
|
-
premultiply: boolean;
|
|
9
|
-
linearRGB: boolean;
|
|
10
|
-
}
|
|
11
|
-
declare global {
|
|
12
|
-
type ImageData = import('./image_data.js').default;
|
|
13
|
-
var ImageData: ImageData['constructor'];
|
|
14
|
-
}
|
|
15
|
-
import type { MozJPEGModule as MozJPEGEncodeModule } from '../../codecs/mozjpeg/enc/mozjpeg_enc';
|
|
16
|
-
import type { WebPModule as WebPEncodeModule } from '../../codecs/webp/enc/webp_enc';
|
|
17
|
-
import type { AVIFModule as AVIFEncodeModule } from '../../codecs/avif/enc/avif_enc';
|
|
18
|
-
import type { JXLModule as JXLEncodeModule } from '../../codecs/jxl/enc/jxl_enc';
|
|
19
|
-
import type { WP2Module as WP2EncodeModule } from '../../codecs/wp2/enc/wp2_enc';
|
|
20
|
-
import * as pngEncDec from '../../codecs/png/pkg/squoosh_png.js';
|
|
21
|
-
import ImageData from './image_data.js';
|
|
22
|
-
export declare const preprocessors: {
|
|
23
|
-
readonly resize: {
|
|
24
|
-
readonly name: "Resize";
|
|
25
|
-
readonly description: "Resize the image before compressing";
|
|
26
|
-
readonly instantiate: () => Promise<(buffer: Uint8Array, input_width: number, input_height: number, { width, height, method, premultiply, linearRGB, }: ResizeInstantiateOptions) => ImageData>;
|
|
27
|
-
readonly defaultOptions: {
|
|
28
|
-
readonly method: "lanczos3";
|
|
29
|
-
readonly fitMethod: "stretch";
|
|
30
|
-
readonly premultiply: true;
|
|
31
|
-
readonly linearRGB: true;
|
|
32
|
-
};
|
|
33
|
-
};
|
|
34
|
-
readonly quant: {
|
|
35
|
-
readonly name: "ImageQuant";
|
|
36
|
-
readonly description: "Reduce the number of colors used (aka. paletting)";
|
|
37
|
-
readonly instantiate: () => Promise<(buffer: Uint8Array, width: number, height: number, { maxNumColors, dither }: {
|
|
38
|
-
maxNumColors: number;
|
|
39
|
-
dither: number;
|
|
40
|
-
}) => ImageData>;
|
|
41
|
-
readonly defaultOptions: {
|
|
42
|
-
readonly maxNumColors: 255;
|
|
43
|
-
readonly dither: 1;
|
|
44
|
-
};
|
|
45
|
-
};
|
|
46
|
-
readonly rotate: {
|
|
47
|
-
readonly name: "Rotate";
|
|
48
|
-
readonly description: "Rotate image";
|
|
49
|
-
readonly instantiate: () => Promise<(buffer: Uint8Array, width: number, height: number, { numRotations }: {
|
|
50
|
-
numRotations: number;
|
|
51
|
-
}) => Promise<ImageData>>;
|
|
52
|
-
readonly defaultOptions: {
|
|
53
|
-
readonly numRotations: 0;
|
|
54
|
-
};
|
|
55
|
-
};
|
|
56
|
-
};
|
|
57
|
-
export declare const codecs: {
|
|
58
|
-
readonly mozjpeg: {
|
|
59
|
-
readonly name: "MozJPEG";
|
|
60
|
-
readonly extension: "jpg";
|
|
61
|
-
readonly detectors: readonly [RegExp];
|
|
62
|
-
readonly dec: () => Promise<DecodeModule>;
|
|
63
|
-
readonly enc: () => Promise<MozJPEGEncodeModule>;
|
|
64
|
-
readonly defaultEncoderOptions: {
|
|
65
|
-
readonly quality: 75;
|
|
66
|
-
readonly baseline: false;
|
|
67
|
-
readonly arithmetic: false;
|
|
68
|
-
readonly progressive: true;
|
|
69
|
-
readonly optimize_coding: true;
|
|
70
|
-
readonly smoothing: 0;
|
|
71
|
-
readonly color_space: 3;
|
|
72
|
-
readonly quant_table: 3;
|
|
73
|
-
readonly trellis_multipass: false;
|
|
74
|
-
readonly trellis_opt_zero: false;
|
|
75
|
-
readonly trellis_opt_table: false;
|
|
76
|
-
readonly trellis_loops: 1;
|
|
77
|
-
readonly auto_subsample: true;
|
|
78
|
-
readonly chroma_subsample: 2;
|
|
79
|
-
readonly separate_chroma_quality: false;
|
|
80
|
-
readonly chroma_quality: 75;
|
|
81
|
-
};
|
|
82
|
-
readonly autoOptimize: {
|
|
83
|
-
readonly option: "quality";
|
|
84
|
-
readonly min: 0;
|
|
85
|
-
readonly max: 100;
|
|
86
|
-
};
|
|
87
|
-
};
|
|
88
|
-
readonly webp: {
|
|
89
|
-
readonly name: "WebP";
|
|
90
|
-
readonly extension: "webp";
|
|
91
|
-
readonly detectors: readonly [RegExp];
|
|
92
|
-
readonly dec: () => Promise<DecodeModule>;
|
|
93
|
-
readonly enc: () => Promise<WebPEncodeModule>;
|
|
94
|
-
readonly defaultEncoderOptions: {
|
|
95
|
-
readonly quality: 75;
|
|
96
|
-
readonly target_size: 0;
|
|
97
|
-
readonly target_PSNR: 0;
|
|
98
|
-
readonly method: 4;
|
|
99
|
-
readonly sns_strength: 50;
|
|
100
|
-
readonly filter_strength: 60;
|
|
101
|
-
readonly filter_sharpness: 0;
|
|
102
|
-
readonly filter_type: 1;
|
|
103
|
-
readonly partitions: 0;
|
|
104
|
-
readonly segments: 4;
|
|
105
|
-
readonly pass: 1;
|
|
106
|
-
readonly show_compressed: 0;
|
|
107
|
-
readonly preprocessing: 0;
|
|
108
|
-
readonly autofilter: 0;
|
|
109
|
-
readonly partition_limit: 0;
|
|
110
|
-
readonly alpha_compression: 1;
|
|
111
|
-
readonly alpha_filtering: 1;
|
|
112
|
-
readonly alpha_quality: 100;
|
|
113
|
-
readonly lossless: 0;
|
|
114
|
-
readonly exact: 0;
|
|
115
|
-
readonly image_hint: 0;
|
|
116
|
-
readonly emulate_jpeg_size: 0;
|
|
117
|
-
readonly thread_level: 0;
|
|
118
|
-
readonly low_memory: 0;
|
|
119
|
-
readonly near_lossless: 100;
|
|
120
|
-
readonly use_delta_palette: 0;
|
|
121
|
-
readonly use_sharp_yuv: 0;
|
|
122
|
-
};
|
|
123
|
-
readonly autoOptimize: {
|
|
124
|
-
readonly option: "quality";
|
|
125
|
-
readonly min: 0;
|
|
126
|
-
readonly max: 100;
|
|
127
|
-
};
|
|
128
|
-
};
|
|
129
|
-
readonly avif: {
|
|
130
|
-
readonly name: "AVIF";
|
|
131
|
-
readonly extension: "avif";
|
|
132
|
-
readonly detectors: readonly [RegExp];
|
|
133
|
-
readonly dec: () => Promise<DecodeModule>;
|
|
134
|
-
readonly enc: () => Promise<AVIFEncodeModule>;
|
|
135
|
-
readonly defaultEncoderOptions: {
|
|
136
|
-
readonly cqLevel: 33;
|
|
137
|
-
readonly cqAlphaLevel: -1;
|
|
138
|
-
readonly denoiseLevel: 0;
|
|
139
|
-
readonly tileColsLog2: 0;
|
|
140
|
-
readonly tileRowsLog2: 0;
|
|
141
|
-
readonly speed: 6;
|
|
142
|
-
readonly subsample: 1;
|
|
143
|
-
readonly chromaDeltaQ: false;
|
|
144
|
-
readonly sharpness: 0;
|
|
145
|
-
readonly tune: 0;
|
|
146
|
-
};
|
|
147
|
-
readonly autoOptimize: {
|
|
148
|
-
readonly option: "cqLevel";
|
|
149
|
-
readonly min: 62;
|
|
150
|
-
readonly max: 0;
|
|
151
|
-
};
|
|
152
|
-
};
|
|
153
|
-
readonly jxl: {
|
|
154
|
-
readonly name: "JPEG-XL";
|
|
155
|
-
readonly extension: "jxl";
|
|
156
|
-
readonly detectors: readonly [RegExp];
|
|
157
|
-
readonly dec: () => Promise<DecodeModule>;
|
|
158
|
-
readonly enc: () => Promise<JXLEncodeModule>;
|
|
159
|
-
readonly defaultEncoderOptions: {
|
|
160
|
-
readonly speed: 4;
|
|
161
|
-
readonly quality: 75;
|
|
162
|
-
readonly progressive: false;
|
|
163
|
-
readonly epf: -1;
|
|
164
|
-
readonly nearLossless: 0;
|
|
165
|
-
readonly lossyPalette: false;
|
|
166
|
-
readonly decodingSpeedTier: 0;
|
|
167
|
-
};
|
|
168
|
-
readonly autoOptimize: {
|
|
169
|
-
readonly option: "quality";
|
|
170
|
-
readonly min: 0;
|
|
171
|
-
readonly max: 100;
|
|
172
|
-
};
|
|
173
|
-
};
|
|
174
|
-
readonly wp2: {
|
|
175
|
-
readonly name: "WebP2";
|
|
176
|
-
readonly extension: "wp2";
|
|
177
|
-
readonly detectors: readonly [RegExp];
|
|
178
|
-
readonly dec: () => Promise<DecodeModule>;
|
|
179
|
-
readonly enc: () => Promise<WP2EncodeModule>;
|
|
180
|
-
readonly defaultEncoderOptions: {
|
|
181
|
-
readonly quality: 75;
|
|
182
|
-
readonly alpha_quality: 75;
|
|
183
|
-
readonly effort: 5;
|
|
184
|
-
readonly pass: 1;
|
|
185
|
-
readonly sns: 50;
|
|
186
|
-
readonly uv_mode: 0;
|
|
187
|
-
readonly csp_type: 0;
|
|
188
|
-
readonly error_diffusion: 0;
|
|
189
|
-
readonly use_random_matrix: false;
|
|
190
|
-
};
|
|
191
|
-
readonly autoOptimize: {
|
|
192
|
-
readonly option: "quality";
|
|
193
|
-
readonly min: 0;
|
|
194
|
-
readonly max: 100;
|
|
195
|
-
};
|
|
196
|
-
};
|
|
197
|
-
readonly oxipng: {
|
|
198
|
-
readonly name: "OxiPNG";
|
|
199
|
-
readonly extension: "png";
|
|
200
|
-
readonly detectors: readonly [RegExp];
|
|
201
|
-
readonly dec: () => Promise<{
|
|
202
|
-
decode: typeof pngEncDec.decode;
|
|
203
|
-
}>;
|
|
204
|
-
readonly enc: () => Promise<{
|
|
205
|
-
encode: (buffer: Uint8ClampedArray | ArrayBuffer, width: number, height: number, opts: {
|
|
206
|
-
level: number;
|
|
207
|
-
interlace: boolean;
|
|
208
|
-
}) => Uint8Array;
|
|
209
|
-
}>;
|
|
210
|
-
readonly defaultEncoderOptions: {
|
|
211
|
-
readonly level: 2;
|
|
212
|
-
readonly interlace: false;
|
|
213
|
-
};
|
|
214
|
-
readonly autoOptimize: {
|
|
215
|
-
readonly option: "level";
|
|
216
|
-
readonly min: 6;
|
|
217
|
-
readonly max: 1;
|
|
218
|
-
};
|
|
219
|
-
};
|
|
220
|
-
};
|
|
221
|
-
export {};
|
|
1
|
+
interface DecodeModule extends EmscriptenWasm.Module {
|
|
2
|
+
decode: (data: Uint8Array) => ImageData;
|
|
3
|
+
}
|
|
4
|
+
interface ResizeInstantiateOptions {
|
|
5
|
+
width: number;
|
|
6
|
+
height: number;
|
|
7
|
+
method: string;
|
|
8
|
+
premultiply: boolean;
|
|
9
|
+
linearRGB: boolean;
|
|
10
|
+
}
|
|
11
|
+
declare global {
|
|
12
|
+
type ImageData = import('./image_data.js').default;
|
|
13
|
+
var ImageData: ImageData['constructor'];
|
|
14
|
+
}
|
|
15
|
+
import type { MozJPEGModule as MozJPEGEncodeModule } from '../../codecs/mozjpeg/enc/mozjpeg_enc';
|
|
16
|
+
import type { WebPModule as WebPEncodeModule } from '../../codecs/webp/enc/webp_enc';
|
|
17
|
+
import type { AVIFModule as AVIFEncodeModule } from '../../codecs/avif/enc/avif_enc';
|
|
18
|
+
import type { JXLModule as JXLEncodeModule } from '../../codecs/jxl/enc/jxl_enc';
|
|
19
|
+
import type { WP2Module as WP2EncodeModule } from '../../codecs/wp2/enc/wp2_enc';
|
|
20
|
+
import * as pngEncDec from '../../codecs/png/pkg/squoosh_png.js';
|
|
21
|
+
import ImageData from './image_data.js';
|
|
22
|
+
export declare const preprocessors: {
|
|
23
|
+
readonly resize: {
|
|
24
|
+
readonly name: "Resize";
|
|
25
|
+
readonly description: "Resize the image before compressing";
|
|
26
|
+
readonly instantiate: () => Promise<(buffer: Uint8Array, input_width: number, input_height: number, { width, height, method, premultiply, linearRGB, }: ResizeInstantiateOptions) => ImageData>;
|
|
27
|
+
readonly defaultOptions: {
|
|
28
|
+
readonly method: "lanczos3";
|
|
29
|
+
readonly fitMethod: "stretch";
|
|
30
|
+
readonly premultiply: true;
|
|
31
|
+
readonly linearRGB: true;
|
|
32
|
+
};
|
|
33
|
+
};
|
|
34
|
+
readonly quant: {
|
|
35
|
+
readonly name: "ImageQuant";
|
|
36
|
+
readonly description: "Reduce the number of colors used (aka. paletting)";
|
|
37
|
+
readonly instantiate: () => Promise<(buffer: Uint8Array, width: number, height: number, { maxNumColors, dither }: {
|
|
38
|
+
maxNumColors: number;
|
|
39
|
+
dither: number;
|
|
40
|
+
}) => ImageData>;
|
|
41
|
+
readonly defaultOptions: {
|
|
42
|
+
readonly maxNumColors: 255;
|
|
43
|
+
readonly dither: 1;
|
|
44
|
+
};
|
|
45
|
+
};
|
|
46
|
+
readonly rotate: {
|
|
47
|
+
readonly name: "Rotate";
|
|
48
|
+
readonly description: "Rotate image";
|
|
49
|
+
readonly instantiate: () => Promise<(buffer: Uint8Array, width: number, height: number, { numRotations }: {
|
|
50
|
+
numRotations: number;
|
|
51
|
+
}) => Promise<ImageData>>;
|
|
52
|
+
readonly defaultOptions: {
|
|
53
|
+
readonly numRotations: 0;
|
|
54
|
+
};
|
|
55
|
+
};
|
|
56
|
+
};
|
|
57
|
+
export declare const codecs: {
|
|
58
|
+
readonly mozjpeg: {
|
|
59
|
+
readonly name: "MozJPEG";
|
|
60
|
+
readonly extension: "jpg";
|
|
61
|
+
readonly detectors: readonly [RegExp];
|
|
62
|
+
readonly dec: () => Promise<DecodeModule>;
|
|
63
|
+
readonly enc: () => Promise<MozJPEGEncodeModule>;
|
|
64
|
+
readonly defaultEncoderOptions: {
|
|
65
|
+
readonly quality: 75;
|
|
66
|
+
readonly baseline: false;
|
|
67
|
+
readonly arithmetic: false;
|
|
68
|
+
readonly progressive: true;
|
|
69
|
+
readonly optimize_coding: true;
|
|
70
|
+
readonly smoothing: 0;
|
|
71
|
+
readonly color_space: 3;
|
|
72
|
+
readonly quant_table: 3;
|
|
73
|
+
readonly trellis_multipass: false;
|
|
74
|
+
readonly trellis_opt_zero: false;
|
|
75
|
+
readonly trellis_opt_table: false;
|
|
76
|
+
readonly trellis_loops: 1;
|
|
77
|
+
readonly auto_subsample: true;
|
|
78
|
+
readonly chroma_subsample: 2;
|
|
79
|
+
readonly separate_chroma_quality: false;
|
|
80
|
+
readonly chroma_quality: 75;
|
|
81
|
+
};
|
|
82
|
+
readonly autoOptimize: {
|
|
83
|
+
readonly option: "quality";
|
|
84
|
+
readonly min: 0;
|
|
85
|
+
readonly max: 100;
|
|
86
|
+
};
|
|
87
|
+
};
|
|
88
|
+
readonly webp: {
|
|
89
|
+
readonly name: "WebP";
|
|
90
|
+
readonly extension: "webp";
|
|
91
|
+
readonly detectors: readonly [RegExp];
|
|
92
|
+
readonly dec: () => Promise<DecodeModule>;
|
|
93
|
+
readonly enc: () => Promise<WebPEncodeModule>;
|
|
94
|
+
readonly defaultEncoderOptions: {
|
|
95
|
+
readonly quality: 75;
|
|
96
|
+
readonly target_size: 0;
|
|
97
|
+
readonly target_PSNR: 0;
|
|
98
|
+
readonly method: 4;
|
|
99
|
+
readonly sns_strength: 50;
|
|
100
|
+
readonly filter_strength: 60;
|
|
101
|
+
readonly filter_sharpness: 0;
|
|
102
|
+
readonly filter_type: 1;
|
|
103
|
+
readonly partitions: 0;
|
|
104
|
+
readonly segments: 4;
|
|
105
|
+
readonly pass: 1;
|
|
106
|
+
readonly show_compressed: 0;
|
|
107
|
+
readonly preprocessing: 0;
|
|
108
|
+
readonly autofilter: 0;
|
|
109
|
+
readonly partition_limit: 0;
|
|
110
|
+
readonly alpha_compression: 1;
|
|
111
|
+
readonly alpha_filtering: 1;
|
|
112
|
+
readonly alpha_quality: 100;
|
|
113
|
+
readonly lossless: 0;
|
|
114
|
+
readonly exact: 0;
|
|
115
|
+
readonly image_hint: 0;
|
|
116
|
+
readonly emulate_jpeg_size: 0;
|
|
117
|
+
readonly thread_level: 0;
|
|
118
|
+
readonly low_memory: 0;
|
|
119
|
+
readonly near_lossless: 100;
|
|
120
|
+
readonly use_delta_palette: 0;
|
|
121
|
+
readonly use_sharp_yuv: 0;
|
|
122
|
+
};
|
|
123
|
+
readonly autoOptimize: {
|
|
124
|
+
readonly option: "quality";
|
|
125
|
+
readonly min: 0;
|
|
126
|
+
readonly max: 100;
|
|
127
|
+
};
|
|
128
|
+
};
|
|
129
|
+
readonly avif: {
|
|
130
|
+
readonly name: "AVIF";
|
|
131
|
+
readonly extension: "avif";
|
|
132
|
+
readonly detectors: readonly [RegExp];
|
|
133
|
+
readonly dec: () => Promise<DecodeModule>;
|
|
134
|
+
readonly enc: () => Promise<AVIFEncodeModule>;
|
|
135
|
+
readonly defaultEncoderOptions: {
|
|
136
|
+
readonly cqLevel: 33;
|
|
137
|
+
readonly cqAlphaLevel: -1;
|
|
138
|
+
readonly denoiseLevel: 0;
|
|
139
|
+
readonly tileColsLog2: 0;
|
|
140
|
+
readonly tileRowsLog2: 0;
|
|
141
|
+
readonly speed: 6;
|
|
142
|
+
readonly subsample: 1;
|
|
143
|
+
readonly chromaDeltaQ: false;
|
|
144
|
+
readonly sharpness: 0;
|
|
145
|
+
readonly tune: 0;
|
|
146
|
+
};
|
|
147
|
+
readonly autoOptimize: {
|
|
148
|
+
readonly option: "cqLevel";
|
|
149
|
+
readonly min: 62;
|
|
150
|
+
readonly max: 0;
|
|
151
|
+
};
|
|
152
|
+
};
|
|
153
|
+
readonly jxl: {
|
|
154
|
+
readonly name: "JPEG-XL";
|
|
155
|
+
readonly extension: "jxl";
|
|
156
|
+
readonly detectors: readonly [RegExp];
|
|
157
|
+
readonly dec: () => Promise<DecodeModule>;
|
|
158
|
+
readonly enc: () => Promise<JXLEncodeModule>;
|
|
159
|
+
readonly defaultEncoderOptions: {
|
|
160
|
+
readonly speed: 4;
|
|
161
|
+
readonly quality: 75;
|
|
162
|
+
readonly progressive: false;
|
|
163
|
+
readonly epf: -1;
|
|
164
|
+
readonly nearLossless: 0;
|
|
165
|
+
readonly lossyPalette: false;
|
|
166
|
+
readonly decodingSpeedTier: 0;
|
|
167
|
+
};
|
|
168
|
+
readonly autoOptimize: {
|
|
169
|
+
readonly option: "quality";
|
|
170
|
+
readonly min: 0;
|
|
171
|
+
readonly max: 100;
|
|
172
|
+
};
|
|
173
|
+
};
|
|
174
|
+
readonly wp2: {
|
|
175
|
+
readonly name: "WebP2";
|
|
176
|
+
readonly extension: "wp2";
|
|
177
|
+
readonly detectors: readonly [RegExp];
|
|
178
|
+
readonly dec: () => Promise<DecodeModule>;
|
|
179
|
+
readonly enc: () => Promise<WP2EncodeModule>;
|
|
180
|
+
readonly defaultEncoderOptions: {
|
|
181
|
+
readonly quality: 75;
|
|
182
|
+
readonly alpha_quality: 75;
|
|
183
|
+
readonly effort: 5;
|
|
184
|
+
readonly pass: 1;
|
|
185
|
+
readonly sns: 50;
|
|
186
|
+
readonly uv_mode: 0;
|
|
187
|
+
readonly csp_type: 0;
|
|
188
|
+
readonly error_diffusion: 0;
|
|
189
|
+
readonly use_random_matrix: false;
|
|
190
|
+
};
|
|
191
|
+
readonly autoOptimize: {
|
|
192
|
+
readonly option: "quality";
|
|
193
|
+
readonly min: 0;
|
|
194
|
+
readonly max: 100;
|
|
195
|
+
};
|
|
196
|
+
};
|
|
197
|
+
readonly oxipng: {
|
|
198
|
+
readonly name: "OxiPNG";
|
|
199
|
+
readonly extension: "png";
|
|
200
|
+
readonly detectors: readonly [RegExp];
|
|
201
|
+
readonly dec: () => Promise<{
|
|
202
|
+
decode: typeof pngEncDec.decode;
|
|
203
|
+
}>;
|
|
204
|
+
readonly enc: () => Promise<{
|
|
205
|
+
encode: (buffer: Uint8ClampedArray | ArrayBuffer, width: number, height: number, opts: {
|
|
206
|
+
level: number;
|
|
207
|
+
interlace: boolean;
|
|
208
|
+
}) => Uint8Array;
|
|
209
|
+
}>;
|
|
210
|
+
readonly defaultEncoderOptions: {
|
|
211
|
+
readonly level: 2;
|
|
212
|
+
readonly interlace: false;
|
|
213
|
+
};
|
|
214
|
+
readonly autoOptimize: {
|
|
215
|
+
readonly option: "level";
|
|
216
|
+
readonly min: 6;
|
|
217
|
+
readonly max: 1;
|
|
218
|
+
};
|
|
219
|
+
};
|
|
220
|
+
};
|
|
221
|
+
export {};
|
|
222
222
|
//# sourceMappingURL=codecs.d.ts.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export declare function pathify(path: string): string;
|
|
2
|
-
export declare function instantiateEmscriptenWasm<T extends EmscriptenWasm.Module>(factory: EmscriptenWasm.ModuleFactory<T>, path: string, workerJS?: string): Promise<T>;
|
|
1
|
+
export declare function pathify(path: string): string;
|
|
2
|
+
export declare function instantiateEmscriptenWasm<T extends EmscriptenWasm.Module>(factory: EmscriptenWasm.ModuleFactory<T>, path: string, workerJS?: string): Promise<T>;
|
|
3
3
|
//# sourceMappingURL=emscripten-utils.d.ts.map
|
package/build/image_data.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export default class ImageData {
|
|
2
|
-
readonly data: Uint8ClampedArray;
|
|
3
|
-
readonly width: number;
|
|
4
|
-
readonly height: number;
|
|
5
|
-
constructor(data: Uint8ClampedArray, width: number, height: number);
|
|
6
|
-
}
|
|
1
|
+
export default class ImageData {
|
|
2
|
+
readonly data: Uint8ClampedArray;
|
|
3
|
+
readonly width: number;
|
|
4
|
+
readonly height: number;
|
|
5
|
+
constructor(data: Uint8ClampedArray, width: number, height: number);
|
|
6
|
+
}
|
|
7
7
|
//# sourceMappingURL=image_data.d.ts.map
|
package/build/index.d.ts
CHANGED
|
@@ -1,97 +1,97 @@
|
|
|
1
|
-
import { codecs as encoders, preprocessors } from './codecs.js';
|
|
2
|
-
import WorkerPool from './worker_pool.js';
|
|
3
|
-
import type ImageData from './image_data';
|
|
4
|
-
export { ImagePool, encoders, preprocessors };
|
|
5
|
-
declare type EncoderKey = keyof typeof encoders;
|
|
6
|
-
declare type PreprocessorKey = keyof typeof preprocessors;
|
|
7
|
-
declare function decodeFile({ file, }: {
|
|
8
|
-
file: ArrayBuffer | ArrayLike<number>;
|
|
9
|
-
}): Promise<{
|
|
10
|
-
bitmap: ImageData;
|
|
11
|
-
size: number;
|
|
12
|
-
}>;
|
|
13
|
-
declare function preprocessImage({ preprocessorName, options, image, }: {
|
|
14
|
-
preprocessorName: PreprocessorKey;
|
|
15
|
-
options: any;
|
|
16
|
-
image: {
|
|
17
|
-
bitmap: ImageData;
|
|
18
|
-
};
|
|
19
|
-
}): Promise<{
|
|
20
|
-
bitmap: ImageData;
|
|
21
|
-
}>;
|
|
22
|
-
declare function encodeImage({ bitmap: bitmapIn, encName, encConfig, optimizerButteraugliTarget, maxOptimizerRounds, }: {
|
|
23
|
-
bitmap: ImageData;
|
|
24
|
-
encName: EncoderKey;
|
|
25
|
-
encConfig: any;
|
|
26
|
-
optimizerButteraugliTarget: number;
|
|
27
|
-
maxOptimizerRounds: number;
|
|
28
|
-
}): Promise<{
|
|
29
|
-
optionsUsed: any;
|
|
30
|
-
binary: Uint8Array;
|
|
31
|
-
extension: "jpg" | "webp" | "avif" | "jxl" | "wp2" | "png";
|
|
32
|
-
size: number;
|
|
33
|
-
}>;
|
|
34
|
-
declare type EncodeParams = {
|
|
35
|
-
operation: 'encode';
|
|
36
|
-
} & Parameters<typeof encodeImage>[0];
|
|
37
|
-
declare type DecodeParams = {
|
|
38
|
-
operation: 'decode';
|
|
39
|
-
} & Parameters<typeof decodeFile>[0];
|
|
40
|
-
declare type PreprocessParams = {
|
|
41
|
-
operation: 'preprocess';
|
|
42
|
-
} & Parameters<typeof preprocessImage>[0];
|
|
43
|
-
declare type JobMessage = EncodeParams | DecodeParams | PreprocessParams;
|
|
44
|
-
/**
|
|
45
|
-
* Represents an ingested image.
|
|
46
|
-
*/
|
|
47
|
-
declare class Image {
|
|
48
|
-
file: ArrayBuffer | ArrayLike<number>;
|
|
49
|
-
workerPool: WorkerPool<JobMessage, any>;
|
|
50
|
-
decoded: Promise<{
|
|
51
|
-
bitmap: ImageData;
|
|
52
|
-
}>;
|
|
53
|
-
encodedWith: {
|
|
54
|
-
[key: string]: any;
|
|
55
|
-
};
|
|
56
|
-
constructor(workerPool: WorkerPool<JobMessage, any>, file: ArrayBuffer | ArrayLike<number>);
|
|
57
|
-
/**
|
|
58
|
-
* Define one or several preprocessors to use on the image.
|
|
59
|
-
* @param {object} preprocessOptions - An object with preprocessors to use, and their settings.
|
|
60
|
-
* @returns {Promise<undefined>} - A promise that resolves when all preprocessors have completed their work.
|
|
61
|
-
*/
|
|
62
|
-
preprocess(preprocessOptions?: {}): Promise<void>;
|
|
63
|
-
/**
|
|
64
|
-
* Define one or several encoders to use on the image.
|
|
65
|
-
* @param {object} encodeOptions - An object with encoders to use, and their settings.
|
|
66
|
-
* @returns {Promise<void>} - A promise that resolves when the image has been encoded with all the specified encoders.
|
|
67
|
-
*/
|
|
68
|
-
encode(encodeOptions?: {
|
|
69
|
-
optimizerButteraugliTarget?: number;
|
|
70
|
-
maxOptimizerRounds?: number;
|
|
71
|
-
} & {
|
|
72
|
-
[key in EncoderKey]?: any;
|
|
73
|
-
}): Promise<void>;
|
|
74
|
-
}
|
|
75
|
-
/**
|
|
76
|
-
* A pool where images can be ingested and squooshed.
|
|
77
|
-
*/
|
|
78
|
-
declare class ImagePool {
|
|
79
|
-
workerPool: WorkerPool<JobMessage, any>;
|
|
80
|
-
/**
|
|
81
|
-
* Create a new pool.
|
|
82
|
-
* @param {number} [threads] - Number of concurrent image processes to run in the pool.
|
|
83
|
-
*/
|
|
84
|
-
constructor(threads: number);
|
|
85
|
-
/**
|
|
86
|
-
* Ingest an image into the image pool.
|
|
87
|
-
* @param {ArrayBuffer | ArrayLike<number>} file - The image that should be ingested and decoded.
|
|
88
|
-
* @returns {Image} - A custom class reference to the decoded image.
|
|
89
|
-
*/
|
|
90
|
-
ingestImage(file: ArrayBuffer | ArrayLike<number>): Image;
|
|
91
|
-
/**
|
|
92
|
-
* Closes the underlying image processing pipeline. The already processed images will still be there, but no new processing can start.
|
|
93
|
-
* @returns {Promise<void>} - A promise that resolves when the underlying pipeline has closed.
|
|
94
|
-
*/
|
|
95
|
-
close(): Promise<void>;
|
|
96
|
-
}
|
|
1
|
+
import { codecs as encoders, preprocessors } from './codecs.js';
|
|
2
|
+
import WorkerPool from './worker_pool.js';
|
|
3
|
+
import type ImageData from './image_data';
|
|
4
|
+
export { ImagePool, encoders, preprocessors };
|
|
5
|
+
declare type EncoderKey = keyof typeof encoders;
|
|
6
|
+
declare type PreprocessorKey = keyof typeof preprocessors;
|
|
7
|
+
declare function decodeFile({ file, }: {
|
|
8
|
+
file: ArrayBuffer | ArrayLike<number>;
|
|
9
|
+
}): Promise<{
|
|
10
|
+
bitmap: ImageData;
|
|
11
|
+
size: number;
|
|
12
|
+
}>;
|
|
13
|
+
declare function preprocessImage({ preprocessorName, options, image, }: {
|
|
14
|
+
preprocessorName: PreprocessorKey;
|
|
15
|
+
options: any;
|
|
16
|
+
image: {
|
|
17
|
+
bitmap: ImageData;
|
|
18
|
+
};
|
|
19
|
+
}): Promise<{
|
|
20
|
+
bitmap: ImageData;
|
|
21
|
+
}>;
|
|
22
|
+
declare function encodeImage({ bitmap: bitmapIn, encName, encConfig, optimizerButteraugliTarget, maxOptimizerRounds, }: {
|
|
23
|
+
bitmap: ImageData;
|
|
24
|
+
encName: EncoderKey;
|
|
25
|
+
encConfig: any;
|
|
26
|
+
optimizerButteraugliTarget: number;
|
|
27
|
+
maxOptimizerRounds: number;
|
|
28
|
+
}): Promise<{
|
|
29
|
+
optionsUsed: any;
|
|
30
|
+
binary: Uint8Array;
|
|
31
|
+
extension: "jpg" | "webp" | "avif" | "jxl" | "wp2" | "png";
|
|
32
|
+
size: number;
|
|
33
|
+
}>;
|
|
34
|
+
declare type EncodeParams = {
|
|
35
|
+
operation: 'encode';
|
|
36
|
+
} & Parameters<typeof encodeImage>[0];
|
|
37
|
+
declare type DecodeParams = {
|
|
38
|
+
operation: 'decode';
|
|
39
|
+
} & Parameters<typeof decodeFile>[0];
|
|
40
|
+
declare type PreprocessParams = {
|
|
41
|
+
operation: 'preprocess';
|
|
42
|
+
} & Parameters<typeof preprocessImage>[0];
|
|
43
|
+
declare type JobMessage = EncodeParams | DecodeParams | PreprocessParams;
|
|
44
|
+
/**
|
|
45
|
+
* Represents an ingested image.
|
|
46
|
+
*/
|
|
47
|
+
declare class Image {
|
|
48
|
+
file: ArrayBuffer | ArrayLike<number>;
|
|
49
|
+
workerPool: WorkerPool<JobMessage, any>;
|
|
50
|
+
decoded: Promise<{
|
|
51
|
+
bitmap: ImageData;
|
|
52
|
+
}>;
|
|
53
|
+
encodedWith: {
|
|
54
|
+
[key: string]: any;
|
|
55
|
+
};
|
|
56
|
+
constructor(workerPool: WorkerPool<JobMessage, any>, file: ArrayBuffer | ArrayLike<number>);
|
|
57
|
+
/**
|
|
58
|
+
* Define one or several preprocessors to use on the image.
|
|
59
|
+
* @param {object} preprocessOptions - An object with preprocessors to use, and their settings.
|
|
60
|
+
* @returns {Promise<undefined>} - A promise that resolves when all preprocessors have completed their work.
|
|
61
|
+
*/
|
|
62
|
+
preprocess(preprocessOptions?: {}): Promise<void>;
|
|
63
|
+
/**
|
|
64
|
+
* Define one or several encoders to use on the image.
|
|
65
|
+
* @param {object} encodeOptions - An object with encoders to use, and their settings.
|
|
66
|
+
* @returns {Promise<void>} - A promise that resolves when the image has been encoded with all the specified encoders.
|
|
67
|
+
*/
|
|
68
|
+
encode(encodeOptions?: {
|
|
69
|
+
optimizerButteraugliTarget?: number;
|
|
70
|
+
maxOptimizerRounds?: number;
|
|
71
|
+
} & {
|
|
72
|
+
[key in EncoderKey]?: any;
|
|
73
|
+
}): Promise<void>;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* A pool where images can be ingested and squooshed.
|
|
77
|
+
*/
|
|
78
|
+
declare class ImagePool {
|
|
79
|
+
workerPool: WorkerPool<JobMessage, any>;
|
|
80
|
+
/**
|
|
81
|
+
* Create a new pool.
|
|
82
|
+
* @param {number} [threads] - Number of concurrent image processes to run in the pool.
|
|
83
|
+
*/
|
|
84
|
+
constructor(threads: number);
|
|
85
|
+
/**
|
|
86
|
+
* Ingest an image into the image pool.
|
|
87
|
+
* @param {ArrayBuffer | ArrayLike<number>} file - The image that should be ingested and decoded.
|
|
88
|
+
* @returns {Image} - A custom class reference to the decoded image.
|
|
89
|
+
*/
|
|
90
|
+
ingestImage(file: ArrayBuffer | ArrayLike<number>): Image;
|
|
91
|
+
/**
|
|
92
|
+
* Closes the underlying image processing pipeline. The already processed images will still be there, but no new processing can start.
|
|
93
|
+
* @returns {Promise<void>} - A promise that resolves when the underlying pipeline has closed.
|
|
94
|
+
*/
|
|
95
|
+
close(): Promise<void>;
|
|
96
|
+
}
|
|
97
97
|
//# sourceMappingURL=index.d.ts.map
|