mikro-orm-attachments 1.3.2 → 2.0.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/CHANGELOG.md +2 -0
- package/dist/converters/BaseConverter.js +1 -0
- package/dist/converters/ImgkitConverter.d.ts +877 -0
- package/dist/converters/ImgkitConverter.js +1 -0
- package/dist/converters/SharpConverter.d.ts +38 -0
- package/dist/converters/SharpConverter.js +1 -0
- package/dist/index.d.ts +67 -160
- package/dist/index.js +1 -1
- package/dist/metadata/BaseMetadata.d.ts +25 -0
- package/dist/metadata/BaseMetadata.js +1 -0
- package/dist/metadata/ImgkitMetadata.d.ts +28 -0
- package/dist/metadata/ImgkitMetadata.js +1 -0
- package/dist/metadata/SharpMetadata.js +1 -0
- package/dist/shared/chunk-4thj50nc.js +2 -0
- package/dist/shared/chunk-523ncfdc.js +2 -0
- package/dist/shared/chunk-cm81a68q.js +2 -0
- package/package.json +41 -10
|
@@ -0,0 +1,877 @@
|
|
|
1
|
+
type VariantSpec = BaseConverter<ConvertInput, ConvertOutput>;
|
|
2
|
+
interface ConvertInput {
|
|
3
|
+
buffer: Buffer;
|
|
4
|
+
size: number;
|
|
5
|
+
mimeType: string;
|
|
6
|
+
variantName?: string;
|
|
7
|
+
variant?: VariantSpec;
|
|
8
|
+
extname: string;
|
|
9
|
+
}
|
|
10
|
+
interface ConvertOutput {
|
|
11
|
+
buffer: Buffer;
|
|
12
|
+
mimeType: string;
|
|
13
|
+
extname: string;
|
|
14
|
+
}
|
|
15
|
+
declare abstract class BaseConverter<
|
|
16
|
+
TInput extends ConvertInput,
|
|
17
|
+
TOutput extends ConvertOutput
|
|
18
|
+
> {
|
|
19
|
+
abstract supports(input: TInput): Promise<boolean>;
|
|
20
|
+
abstract handle(input: TInput): Promise<TOutput>;
|
|
21
|
+
}
|
|
22
|
+
declare namespace exports_index_d {
|
|
23
|
+
export { writeExifSync, writeExif, version, transformSync, transform, toWebpSync, toWebp, toTensorSync, toTensor, toPngSync, toPng, toJpegSync, toJpeg, thumbnailSync, thumbnailBufferSync, thumbnailBuffer, thumbnail, thumbhashToRgbaSync, thumbhashToRgba, thumbhashToDataUrl, thumbhashSync, thumbhash, stripExifSync, stripExif, smartCropSync, smartCropAnalyzeSync, smartCropAnalyze, smartCrop, resizeSync, resize, metadataSync, metadata, imageHashSync, imageHashDistanceSync, imageHashDistance, imageHash, dominantColorsSync, dominantColors, _default as default, cropSync, crop, blurhashSync, blurhash, WebPOptions, TransformOptions2 as TransformOptions, ThumbnailResult, ThumbnailOptions, ThumbnailFormat, ThumbHashResult, ThumbHashDecodeResult, TensorResult, TensorOptions, TensorNormalization, TensorLayout, TensorDtype, SmartCropOptions, SmartCropBoostRegion, SmartCropAnalysis, ResizeOptions, ResizeFilter, PngOptions, OutputOptions, JpegOptions, ImageMetadata, ImageHashResult, ImageHashOptions, ImageFormat, HashSize, HashAlgorithm, FitMode, ExifOptions, EnhancedTensorResult, DominantColorsResult, DominantColor, CropOptions, CropGravity, BlurHashResult, AvifOptions, AsyncOptions, AspectRatio };
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* imgkit Types
|
|
27
|
+
*/
|
|
28
|
+
/** Supported image formats */
|
|
29
|
+
type ImageFormat = "jpeg" | "png" | "webp" | "gif" | "bmp" | "ico" | "tiff" | "heic" | "avif";
|
|
30
|
+
/** Resize filter/algorithm */
|
|
31
|
+
type ResizeFilter = "nearest" | "bilinear" | "catmullRom" | "mitchell" | "lanczos3";
|
|
32
|
+
/** Image fit mode for resize */
|
|
33
|
+
type FitMode = "cover" | "contain" | "fill" | "inside" | "outside";
|
|
34
|
+
/** Crop gravity/anchor point */
|
|
35
|
+
type CropGravity = "center" | "north" | "south" | "east" | "west" | "northWest" | "northEast" | "southWest" | "southEast";
|
|
36
|
+
/** Crop options */
|
|
37
|
+
interface CropOptions {
|
|
38
|
+
/** X coordinate of crop origin (left edge) */
|
|
39
|
+
x?: number;
|
|
40
|
+
/** Y coordinate of crop origin (top edge) */
|
|
41
|
+
y?: number;
|
|
42
|
+
/** Width of crop region */
|
|
43
|
+
width?: number;
|
|
44
|
+
/** Height of crop region */
|
|
45
|
+
height?: number;
|
|
46
|
+
/** Aspect ratio string (e.g., "16:9", "1:1", "4:3") */
|
|
47
|
+
aspectRatio?: string;
|
|
48
|
+
/** Gravity/anchor point for aspect ratio or dimension-based cropping */
|
|
49
|
+
gravity?: CropGravity;
|
|
50
|
+
}
|
|
51
|
+
/** Resize options */
|
|
52
|
+
interface ResizeOptions {
|
|
53
|
+
/** Target width (optional if height is provided) */
|
|
54
|
+
width?: number;
|
|
55
|
+
/** Target height (optional if width is provided) */
|
|
56
|
+
height?: number;
|
|
57
|
+
/** Resize filter/algorithm (default: lanczos3) */
|
|
58
|
+
filter?: ResizeFilter;
|
|
59
|
+
/** Fit mode (default: cover) */
|
|
60
|
+
fit?: FitMode;
|
|
61
|
+
/** Background color for padding [r, g, b, a] (default: transparent) */
|
|
62
|
+
background?: number[];
|
|
63
|
+
}
|
|
64
|
+
/** JPEG encode options */
|
|
65
|
+
interface JpegOptions {
|
|
66
|
+
/** Quality 1-100 (default: 80) */
|
|
67
|
+
quality?: number;
|
|
68
|
+
}
|
|
69
|
+
/** PNG encode options */
|
|
70
|
+
interface PngOptions {
|
|
71
|
+
/** Compression level 0-9 (default: 6) */
|
|
72
|
+
compression?: number;
|
|
73
|
+
}
|
|
74
|
+
/** WebP encode options */
|
|
75
|
+
interface WebPOptions {
|
|
76
|
+
/** Quality 1-100 for lossy, ignored for lossless (default: 80) */
|
|
77
|
+
quality?: number;
|
|
78
|
+
/** Use lossless compression (default: false) */
|
|
79
|
+
lossless?: boolean;
|
|
80
|
+
}
|
|
81
|
+
/** AVIF encode options */
|
|
82
|
+
interface AvifOptions {
|
|
83
|
+
/** Quality 1-100 (default: 80) */
|
|
84
|
+
quality?: number;
|
|
85
|
+
/** Speed 1-10, higher is faster but lower quality (default: 6) */
|
|
86
|
+
speed?: number;
|
|
87
|
+
}
|
|
88
|
+
/** Output format options */
|
|
89
|
+
interface OutputOptions {
|
|
90
|
+
/** Output format */
|
|
91
|
+
format: ImageFormat;
|
|
92
|
+
/** JPEG options (if format is jpeg) */
|
|
93
|
+
jpeg?: JpegOptions;
|
|
94
|
+
/** PNG options (if format is png) */
|
|
95
|
+
png?: PngOptions;
|
|
96
|
+
/** WebP options (if format is webp) */
|
|
97
|
+
webp?: WebPOptions;
|
|
98
|
+
/** AVIF options (if format is avif) */
|
|
99
|
+
avif?: AvifOptions;
|
|
100
|
+
}
|
|
101
|
+
/** Image metadata (sharp-compatible) */
|
|
102
|
+
interface ImageMetadata {
|
|
103
|
+
/** Image width in pixels */
|
|
104
|
+
width: number;
|
|
105
|
+
/** Image height in pixels */
|
|
106
|
+
height: number;
|
|
107
|
+
/** Detected format (jpeg, png, webp, gif, bmp, ico, tiff) */
|
|
108
|
+
format: string;
|
|
109
|
+
/** File size in bytes */
|
|
110
|
+
size?: number;
|
|
111
|
+
/** Color space (srgb, rgb, grayscale) */
|
|
112
|
+
space: string;
|
|
113
|
+
/** Number of channels (1, 2, 3, or 4) */
|
|
114
|
+
channels: number;
|
|
115
|
+
/** Bit depth per sample (uchar = 8-bit, ushort = 16-bit) */
|
|
116
|
+
depth: string;
|
|
117
|
+
/** Whether the image has an alpha channel */
|
|
118
|
+
hasAlpha: boolean;
|
|
119
|
+
/** Bits per sample */
|
|
120
|
+
bitsPerSample: number;
|
|
121
|
+
/** Whether the image is progressive (JPEG) or interlaced (PNG) */
|
|
122
|
+
isProgressive: boolean;
|
|
123
|
+
/** Whether the image uses palette/indexed colors (PNG/GIF) */
|
|
124
|
+
isPalette: boolean;
|
|
125
|
+
/** Whether the image has an embedded ICC profile */
|
|
126
|
+
hasProfile: boolean;
|
|
127
|
+
/** EXIF orientation value (1-8, if present) */
|
|
128
|
+
orientation?: number;
|
|
129
|
+
/** Page/frame count for multi-page images (GIF, TIFF) */
|
|
130
|
+
pages?: number;
|
|
131
|
+
/** Loop count for animated images */
|
|
132
|
+
loopCount?: number;
|
|
133
|
+
/** Delay between frames in ms (for animated images) */
|
|
134
|
+
delay?: number[];
|
|
135
|
+
/** Background color (for GIF) */
|
|
136
|
+
background?: number[];
|
|
137
|
+
/** Compression type used */
|
|
138
|
+
compression?: string;
|
|
139
|
+
/** Density/DPI info */
|
|
140
|
+
density?: number;
|
|
141
|
+
}
|
|
142
|
+
/** Blurhash result */
|
|
143
|
+
interface BlurHashResult {
|
|
144
|
+
/** The blurhash string */
|
|
145
|
+
hash: string;
|
|
146
|
+
/** Original width */
|
|
147
|
+
width: number;
|
|
148
|
+
/** Original height */
|
|
149
|
+
height: number;
|
|
150
|
+
}
|
|
151
|
+
/** ThumbHash result */
|
|
152
|
+
interface ThumbHashResult {
|
|
153
|
+
/** The thumbhash bytes (typically ~25 bytes) */
|
|
154
|
+
hash: Buffer;
|
|
155
|
+
/** Base64 data URL for inline CSS/HTML usage */
|
|
156
|
+
dataUrl: string;
|
|
157
|
+
/** Original width */
|
|
158
|
+
width: number;
|
|
159
|
+
/** Original height */
|
|
160
|
+
height: number;
|
|
161
|
+
/** Whether image has alpha channel */
|
|
162
|
+
hasAlpha: boolean;
|
|
163
|
+
}
|
|
164
|
+
/** Decoded thumbhash result (RGBA pixels) */
|
|
165
|
+
interface ThumbHashDecodeResult {
|
|
166
|
+
/** RGBA pixel data */
|
|
167
|
+
rgba: Buffer;
|
|
168
|
+
/** Decoded width */
|
|
169
|
+
width: number;
|
|
170
|
+
/** Decoded height */
|
|
171
|
+
height: number;
|
|
172
|
+
}
|
|
173
|
+
/** EXIF metadata options for writing */
|
|
174
|
+
interface ExifOptions {
|
|
175
|
+
/** Image description / caption / AI prompt */
|
|
176
|
+
imageDescription?: string;
|
|
177
|
+
/** Artist / creator name */
|
|
178
|
+
artist?: string;
|
|
179
|
+
/** Copyright notice */
|
|
180
|
+
copyright?: string;
|
|
181
|
+
/** Software used to create the image */
|
|
182
|
+
software?: string;
|
|
183
|
+
/** Date/time in EXIF format (YYYY:MM:DD HH:MM:SS) */
|
|
184
|
+
dateTime?: string;
|
|
185
|
+
/** Original date/time in EXIF format */
|
|
186
|
+
dateTimeOriginal?: string;
|
|
187
|
+
/** User comment (can contain JSON or other data) */
|
|
188
|
+
userComment?: string;
|
|
189
|
+
/** Camera/device make */
|
|
190
|
+
make?: string;
|
|
191
|
+
/** Camera/device model */
|
|
192
|
+
model?: string;
|
|
193
|
+
/** Orientation (1-8) */
|
|
194
|
+
orientation?: number;
|
|
195
|
+
}
|
|
196
|
+
/** Transform options (all-in-one processing) */
|
|
197
|
+
interface TransformOptions2 {
|
|
198
|
+
/** Crop options (applied before resize) */
|
|
199
|
+
crop?: CropOptions;
|
|
200
|
+
/** Resize options */
|
|
201
|
+
resize?: ResizeOptions;
|
|
202
|
+
/** Output options */
|
|
203
|
+
output?: OutputOptions;
|
|
204
|
+
/** Rotate degrees (90, 180, 270) */
|
|
205
|
+
rotate?: number;
|
|
206
|
+
/** Flip horizontally */
|
|
207
|
+
flipH?: boolean;
|
|
208
|
+
/** Flip vertically */
|
|
209
|
+
flipV?: boolean;
|
|
210
|
+
/** Grayscale conversion */
|
|
211
|
+
grayscale?: boolean;
|
|
212
|
+
/** Blur radius (0-100) */
|
|
213
|
+
blur?: number;
|
|
214
|
+
/** Sharpen amount (0-100) */
|
|
215
|
+
sharpen?: number;
|
|
216
|
+
/** Brightness adjustment (-100 to 100) */
|
|
217
|
+
brightness?: number;
|
|
218
|
+
/** Contrast adjustment (-100 to 100) */
|
|
219
|
+
contrast?: number;
|
|
220
|
+
/** EXIF metadata to write (for JPEG/WebP output) */
|
|
221
|
+
exif?: ExifOptions;
|
|
222
|
+
}
|
|
223
|
+
/** Tensor data type */
|
|
224
|
+
type TensorDtype = "Float32" | "Uint8";
|
|
225
|
+
/** Tensor memory layout */
|
|
226
|
+
type TensorLayout = "Chw" | "Hwc";
|
|
227
|
+
/** Normalization preset */
|
|
228
|
+
type TensorNormalization = "Imagenet" | "Clip" | "ZeroOne" | "NegOneOne" | "None";
|
|
229
|
+
/** Tensor conversion options */
|
|
230
|
+
interface TensorOptions {
|
|
231
|
+
/** Output data type (default: Float32) */
|
|
232
|
+
dtype?: TensorDtype;
|
|
233
|
+
/** Memory layout: 'Chw' for PyTorch/ONNX, 'Hwc' for TensorFlow (default: Chw) */
|
|
234
|
+
layout?: TensorLayout;
|
|
235
|
+
/** Normalization preset (default: None) */
|
|
236
|
+
normalization?: TensorNormalization;
|
|
237
|
+
/** Target width for resize before conversion */
|
|
238
|
+
width?: number;
|
|
239
|
+
/** Target height for resize before conversion */
|
|
240
|
+
height?: number;
|
|
241
|
+
/** Add batch dimension (default: false) */
|
|
242
|
+
batch?: boolean;
|
|
243
|
+
}
|
|
244
|
+
/** Tensor conversion result */
|
|
245
|
+
interface TensorResult {
|
|
246
|
+
/** Raw tensor data as bytes (use toFloat32Array() or toUint8Array() to convert) */
|
|
247
|
+
data: Buffer;
|
|
248
|
+
/** Shape array (e.g., [3, 224, 224] or [1, 3, 224, 224] with batch) */
|
|
249
|
+
shape: number[];
|
|
250
|
+
/** Data type used */
|
|
251
|
+
dtype: TensorDtype;
|
|
252
|
+
/** Memory layout used */
|
|
253
|
+
layout: TensorLayout;
|
|
254
|
+
/** Image width */
|
|
255
|
+
width: number;
|
|
256
|
+
/** Image height */
|
|
257
|
+
height: number;
|
|
258
|
+
/** Number of channels (always 3 for RGB) */
|
|
259
|
+
channels: number;
|
|
260
|
+
}
|
|
261
|
+
/** Perceptual hash algorithm */
|
|
262
|
+
type HashAlgorithm = "PHash" | "DHash" | "AHash" | "BlockHash";
|
|
263
|
+
/** Hash size (dimensions of the hash grid) */
|
|
264
|
+
type HashSize = "Size8" | "Size16" | "Size32";
|
|
265
|
+
/** Perceptual hash options */
|
|
266
|
+
interface ImageHashOptions {
|
|
267
|
+
/** Hash algorithm (default: PHash) */
|
|
268
|
+
algorithm?: HashAlgorithm;
|
|
269
|
+
/** Hash size (default: Size8) */
|
|
270
|
+
size?: HashSize;
|
|
271
|
+
}
|
|
272
|
+
/** Perceptual hash result */
|
|
273
|
+
interface ImageHashResult {
|
|
274
|
+
/** The hash as a base64-encoded string */
|
|
275
|
+
hash: string;
|
|
276
|
+
/** Original image width */
|
|
277
|
+
width: number;
|
|
278
|
+
/** Original image height */
|
|
279
|
+
height: number;
|
|
280
|
+
/** Hash size used (8, 16, or 32) */
|
|
281
|
+
hashSize: number;
|
|
282
|
+
/** Algorithm used */
|
|
283
|
+
algorithm: string;
|
|
284
|
+
}
|
|
285
|
+
/** Common aspect ratios for smart crop */
|
|
286
|
+
type AspectRatio = "1:1" | "16:9" | "9:16" | "4:3" | "3:2" | "21:9" | string;
|
|
287
|
+
/** Boost region for smart crop (prioritize specific areas) */
|
|
288
|
+
interface SmartCropBoostRegion {
|
|
289
|
+
/** X coordinate of the region */
|
|
290
|
+
x: number;
|
|
291
|
+
/** Y coordinate of the region */
|
|
292
|
+
y: number;
|
|
293
|
+
/** Width of the region */
|
|
294
|
+
width: number;
|
|
295
|
+
/** Height of the region */
|
|
296
|
+
height: number;
|
|
297
|
+
/** Weight of the boost (0.0 - 1.0) */
|
|
298
|
+
weight: number;
|
|
299
|
+
}
|
|
300
|
+
/** Smart crop options */
|
|
301
|
+
interface SmartCropOptions {
|
|
302
|
+
/** Target width */
|
|
303
|
+
width?: number;
|
|
304
|
+
/** Target height */
|
|
305
|
+
height?: number;
|
|
306
|
+
/** Aspect ratio string (e.g., "16:9", "1:1", "4:3") */
|
|
307
|
+
aspectRatio?: AspectRatio;
|
|
308
|
+
/** Boost regions (areas to prioritize) */
|
|
309
|
+
boost?: SmartCropBoostRegion[];
|
|
310
|
+
}
|
|
311
|
+
/** Smart crop analysis result (crop coordinates without actual cropping) */
|
|
312
|
+
interface SmartCropAnalysis {
|
|
313
|
+
/** X coordinate of the best crop */
|
|
314
|
+
x: number;
|
|
315
|
+
/** Y coordinate of the best crop */
|
|
316
|
+
y: number;
|
|
317
|
+
/** Width of the best crop */
|
|
318
|
+
width: number;
|
|
319
|
+
/** Height of the best crop */
|
|
320
|
+
height: number;
|
|
321
|
+
/** Score of the best crop (higher is better) */
|
|
322
|
+
score: number;
|
|
323
|
+
}
|
|
324
|
+
/** A single dominant color */
|
|
325
|
+
interface DominantColor {
|
|
326
|
+
/** Red component (0-255) */
|
|
327
|
+
r: number;
|
|
328
|
+
/** Green component (0-255) */
|
|
329
|
+
g: number;
|
|
330
|
+
/** Blue component (0-255) */
|
|
331
|
+
b: number;
|
|
332
|
+
/** Hex color string (e.g., "#FF5733") */
|
|
333
|
+
hex: string;
|
|
334
|
+
}
|
|
335
|
+
/** Dominant colors extraction result */
|
|
336
|
+
interface DominantColorsResult {
|
|
337
|
+
/** Array of dominant colors (sorted by prominence) */
|
|
338
|
+
colors: DominantColor[];
|
|
339
|
+
/** The most dominant color (same as colors[0]) */
|
|
340
|
+
primary: DominantColor;
|
|
341
|
+
}
|
|
342
|
+
/** Output format for thumbnail */
|
|
343
|
+
type ThumbnailFormat = "Jpeg" | "Png" | "Webp";
|
|
344
|
+
/** Options for fast thumbnail generation */
|
|
345
|
+
interface ThumbnailOptions {
|
|
346
|
+
/** Target width (required) */
|
|
347
|
+
width: number;
|
|
348
|
+
/** Target height (optional, maintains aspect ratio if not set) */
|
|
349
|
+
height?: number;
|
|
350
|
+
/** Output format (default: same as input, or JPEG for best speed) */
|
|
351
|
+
format?: ThumbnailFormat;
|
|
352
|
+
/** JPEG/WebP quality 1-100 (default: 80, or 70 in fast mode) */
|
|
353
|
+
quality?: number;
|
|
354
|
+
/**
|
|
355
|
+
* Enable shrink-on-load optimization (default: true)
|
|
356
|
+
*
|
|
357
|
+
* When true, decodes image at reduced resolution before resize.
|
|
358
|
+
* This is 2-10x faster for large images being downscaled.
|
|
359
|
+
*
|
|
360
|
+
* - JPEG: Uses libjpeg-turbo scale factors (1/2, 1/4, 1/8)
|
|
361
|
+
* - WebP: Uses libwebp native scaling during decode
|
|
362
|
+
*/
|
|
363
|
+
shrinkOnLoad?: boolean;
|
|
364
|
+
/** Resize filter (default: auto-select based on scale factor) */
|
|
365
|
+
filter?: ResizeFilter;
|
|
366
|
+
/**
|
|
367
|
+
* Enable fast mode for maximum speed (default: false)
|
|
368
|
+
*
|
|
369
|
+
* When true, applies aggressive optimizations:
|
|
370
|
+
* - More aggressive shrink-on-load (1/8 instead of 1/4 when possible)
|
|
371
|
+
* - Skips final resize if within 15% of target dimensions
|
|
372
|
+
* - Uses Nearest neighbor filter for any remaining resize
|
|
373
|
+
* - Uses lower quality (70 instead of 80)
|
|
374
|
+
*
|
|
375
|
+
* This can be 2-4x faster than normal mode with slight quality tradeoff.
|
|
376
|
+
* Best for generating preview thumbnails where exact dimensions don't matter.
|
|
377
|
+
*/
|
|
378
|
+
fastMode?: boolean;
|
|
379
|
+
}
|
|
380
|
+
/** Fast thumbnail result with metadata */
|
|
381
|
+
interface ThumbnailResult {
|
|
382
|
+
/** The thumbnail image data */
|
|
383
|
+
data: Buffer;
|
|
384
|
+
/** Output width */
|
|
385
|
+
width: number;
|
|
386
|
+
/** Output height */
|
|
387
|
+
height: number;
|
|
388
|
+
/** Output format used */
|
|
389
|
+
format: string;
|
|
390
|
+
/** Whether shrink-on-load was used */
|
|
391
|
+
shrinkOnLoadUsed: boolean;
|
|
392
|
+
/** Original image width */
|
|
393
|
+
originalWidth: number;
|
|
394
|
+
/** Original image height */
|
|
395
|
+
originalHeight: number;
|
|
396
|
+
}
|
|
397
|
+
/** Options for async operations (timeout and cancellation) */
|
|
398
|
+
interface AsyncOptions {
|
|
399
|
+
/** Timeout in milliseconds. Operation rejects after this duration. */
|
|
400
|
+
timeoutMs?: number;
|
|
401
|
+
/** AbortSignal for cancellation. Operation rejects when signal is aborted. */
|
|
402
|
+
signal?: AbortSignal;
|
|
403
|
+
}
|
|
404
|
+
/**
|
|
405
|
+
* Metadata API functions
|
|
406
|
+
*/
|
|
407
|
+
/**
|
|
408
|
+
* Get image metadata asynchronously
|
|
409
|
+
*
|
|
410
|
+
* @param input - Image buffer
|
|
411
|
+
* @param asyncOptions - Timeout and cancellation options
|
|
412
|
+
* @returns Promise resolving to image metadata
|
|
413
|
+
*
|
|
414
|
+
* @example
|
|
415
|
+
* ```typescript
|
|
416
|
+
* const info = await metadata(imageBuffer);
|
|
417
|
+
* console.log(`${info.width}x${info.height} ${info.format}`);
|
|
418
|
+
*
|
|
419
|
+
* // With timeout
|
|
420
|
+
* const info = await metadata(imageBuffer, { timeoutMs: 5000 });
|
|
421
|
+
*
|
|
422
|
+
* // With AbortSignal
|
|
423
|
+
* const controller = new AbortController();
|
|
424
|
+
* const info = await metadata(imageBuffer, { signal: controller.signal });
|
|
425
|
+
* ```
|
|
426
|
+
*/
|
|
427
|
+
declare function metadata(input: Buffer, asyncOptions?: AsyncOptions): Promise<ImageMetadata>;
|
|
428
|
+
/**
|
|
429
|
+
* Get image metadata synchronously
|
|
430
|
+
*/
|
|
431
|
+
declare function metadataSync(input: Buffer): ImageMetadata;
|
|
432
|
+
/**
|
|
433
|
+
* Resize API functions
|
|
434
|
+
*/
|
|
435
|
+
/**
|
|
436
|
+
* Resize image asynchronously
|
|
437
|
+
*
|
|
438
|
+
* @param input - Image buffer
|
|
439
|
+
* @param options - Resize options
|
|
440
|
+
* @param asyncOptions - Timeout and cancellation options
|
|
441
|
+
* @returns Promise resolving to resized image buffer (PNG)
|
|
442
|
+
*
|
|
443
|
+
* @example
|
|
444
|
+
* ```typescript
|
|
445
|
+
* // Resize to specific dimensions
|
|
446
|
+
* const resized = await resize(imageBuffer, { width: 800, height: 600 });
|
|
447
|
+
*
|
|
448
|
+
* // With timeout
|
|
449
|
+
* const resized = await resize(imageBuffer, { width: 800 }, { timeoutMs: 5000 });
|
|
450
|
+
* ```
|
|
451
|
+
*/
|
|
452
|
+
declare function resize(input: Buffer, options: ResizeOptions, asyncOptions?: AsyncOptions): Promise<Buffer>;
|
|
453
|
+
/**
|
|
454
|
+
* Resize image synchronously
|
|
455
|
+
*/
|
|
456
|
+
declare function resizeSync(input: Buffer, options: ResizeOptions): Buffer;
|
|
457
|
+
/**
|
|
458
|
+
* Crop API functions
|
|
459
|
+
*/
|
|
460
|
+
/**
|
|
461
|
+
* Crop an image asynchronously
|
|
462
|
+
*
|
|
463
|
+
* @param input - Image buffer
|
|
464
|
+
* @param options - Crop options
|
|
465
|
+
* @param asyncOptions - Timeout and cancellation options
|
|
466
|
+
* @returns Cropped image as PNG buffer
|
|
467
|
+
*
|
|
468
|
+
* @example
|
|
469
|
+
* ```typescript
|
|
470
|
+
* const cropped = await crop(input, { x: 100, y: 50, width: 800, height: 600 });
|
|
471
|
+
*
|
|
472
|
+
* // With timeout
|
|
473
|
+
* const cropped = await crop(input, { aspectRatio: "1:1" }, { timeoutMs: 5000 });
|
|
474
|
+
* ```
|
|
475
|
+
*/
|
|
476
|
+
declare function crop(input: Buffer, options: CropOptions, asyncOptions?: AsyncOptions): Promise<Buffer>;
|
|
477
|
+
/**
|
|
478
|
+
* Crop an image synchronously
|
|
479
|
+
*/
|
|
480
|
+
declare function cropSync(input: Buffer, options: CropOptions): Buffer;
|
|
481
|
+
/**
|
|
482
|
+
* Image encoding/format conversion API functions
|
|
483
|
+
*/
|
|
484
|
+
/**
|
|
485
|
+
* Convert image to JPEG asynchronously
|
|
486
|
+
*
|
|
487
|
+
* @param input - Image buffer
|
|
488
|
+
* @param options - JPEG encoding options
|
|
489
|
+
* @param asyncOptions - Timeout and cancellation options
|
|
490
|
+
* @returns Promise resolving to JPEG buffer
|
|
491
|
+
*
|
|
492
|
+
* @example
|
|
493
|
+
* ```typescript
|
|
494
|
+
* const jpeg = await toJpeg(imageBuffer, { quality: 85 });
|
|
495
|
+
*
|
|
496
|
+
* // With timeout
|
|
497
|
+
* const jpeg = await toJpeg(imageBuffer, { quality: 85 }, { timeoutMs: 5000 });
|
|
498
|
+
* ```
|
|
499
|
+
*/
|
|
500
|
+
declare function toJpeg(input: Buffer, options?: JpegOptions, asyncOptions?: AsyncOptions): Promise<Buffer>;
|
|
501
|
+
/**
|
|
502
|
+
* Convert image to JPEG synchronously
|
|
503
|
+
*/
|
|
504
|
+
declare function toJpegSync(input: Buffer, options?: JpegOptions): Buffer;
|
|
505
|
+
/**
|
|
506
|
+
* Convert image to PNG asynchronously
|
|
507
|
+
*
|
|
508
|
+
* @param input - Image buffer
|
|
509
|
+
* @param options - PNG encoding options
|
|
510
|
+
* @param asyncOptions - Timeout and cancellation options
|
|
511
|
+
* @returns Promise resolving to PNG buffer
|
|
512
|
+
*/
|
|
513
|
+
declare function toPng(input: Buffer, options?: PngOptions, asyncOptions?: AsyncOptions): Promise<Buffer>;
|
|
514
|
+
/**
|
|
515
|
+
* Convert image to PNG synchronously
|
|
516
|
+
*/
|
|
517
|
+
declare function toPngSync(input: Buffer, options?: PngOptions): Buffer;
|
|
518
|
+
/**
|
|
519
|
+
* Convert image to WebP asynchronously
|
|
520
|
+
*
|
|
521
|
+
* @param input - Image buffer
|
|
522
|
+
* @param options - WebP encoding options
|
|
523
|
+
* @param asyncOptions - Timeout and cancellation options
|
|
524
|
+
* @returns Promise resolving to WebP buffer
|
|
525
|
+
*/
|
|
526
|
+
declare function toWebp(input: Buffer, options?: WebPOptions, asyncOptions?: AsyncOptions): Promise<Buffer>;
|
|
527
|
+
/**
|
|
528
|
+
* Convert image to WebP synchronously
|
|
529
|
+
*/
|
|
530
|
+
declare function toWebpSync(input: Buffer, options?: WebPOptions): Buffer;
|
|
531
|
+
/**
|
|
532
|
+
* Transform API functions
|
|
533
|
+
*/
|
|
534
|
+
/**
|
|
535
|
+
* Transform image with multiple operations asynchronously
|
|
536
|
+
*
|
|
537
|
+
* @param input - Image buffer
|
|
538
|
+
* @param options - Transform options
|
|
539
|
+
* @param asyncOptions - Timeout and cancellation options
|
|
540
|
+
* @returns Promise resolving to transformed image buffer
|
|
541
|
+
*
|
|
542
|
+
* @example
|
|
543
|
+
* ```typescript
|
|
544
|
+
* const result = await transform(imageBuffer, {
|
|
545
|
+
* resize: { width: 800, height: 600 },
|
|
546
|
+
* rotate: 90,
|
|
547
|
+
* grayscale: true,
|
|
548
|
+
* output: { format: 'webp', webp: { quality: 85 } }
|
|
549
|
+
* }, { timeoutMs: 10000 });
|
|
550
|
+
* ```
|
|
551
|
+
*/
|
|
552
|
+
declare function transform(input: Buffer, options: TransformOptions2, asyncOptions?: AsyncOptions): Promise<Buffer>;
|
|
553
|
+
/**
|
|
554
|
+
* Transform image with multiple operations synchronously
|
|
555
|
+
*/
|
|
556
|
+
declare function transformSync(input: Buffer, options: TransformOptions2): Buffer;
|
|
557
|
+
/**
|
|
558
|
+
* Blurhash API functions
|
|
559
|
+
*/
|
|
560
|
+
/**
|
|
561
|
+
* Generate blurhash from image asynchronously
|
|
562
|
+
*
|
|
563
|
+
* @param input - Image buffer
|
|
564
|
+
* @param componentsX - Number of X components (default: 4)
|
|
565
|
+
* @param componentsY - Number of Y components (default: 3)
|
|
566
|
+
* @param asyncOptions - Timeout and cancellation options
|
|
567
|
+
* @returns Promise resolving to blurhash result
|
|
568
|
+
*
|
|
569
|
+
* @example
|
|
570
|
+
* ```typescript
|
|
571
|
+
* const { hash, width, height } = await blurhash(imageBuffer);
|
|
572
|
+
*
|
|
573
|
+
* // With timeout
|
|
574
|
+
* const { hash } = await blurhash(imageBuffer, 4, 3, { timeoutMs: 5000 });
|
|
575
|
+
* ```
|
|
576
|
+
*/
|
|
577
|
+
declare function blurhash(input: Buffer, componentsX?: number, componentsY?: number, asyncOptions?: AsyncOptions): Promise<BlurHashResult>;
|
|
578
|
+
/**
|
|
579
|
+
* Generate blurhash from image synchronously
|
|
580
|
+
*/
|
|
581
|
+
declare function blurhashSync(input: Buffer, componentsX?: number, componentsY?: number): BlurHashResult;
|
|
582
|
+
/**
|
|
583
|
+
* ThumbHash API functions
|
|
584
|
+
*
|
|
585
|
+
* ThumbHash is a compact image placeholder that produces smoother,
|
|
586
|
+
* more visually pleasing placeholders compared to BlurHash.
|
|
587
|
+
*/
|
|
588
|
+
/**
|
|
589
|
+
* Generate thumbhash from image asynchronously
|
|
590
|
+
*
|
|
591
|
+
* @param input - Image buffer (JPEG, PNG, WebP, etc.)
|
|
592
|
+
* @param asyncOptions - Timeout and cancellation options
|
|
593
|
+
* @returns Promise resolving to thumbhash result with data URL
|
|
594
|
+
*
|
|
595
|
+
* @example
|
|
596
|
+
* ```typescript
|
|
597
|
+
* const { hash, dataUrl } = await thumbhash(imageBuffer);
|
|
598
|
+
*
|
|
599
|
+
* // With timeout
|
|
600
|
+
* const { hash } = await thumbhash(imageBuffer, { timeoutMs: 5000 });
|
|
601
|
+
* ```
|
|
602
|
+
*/
|
|
603
|
+
declare function thumbhash(input: Buffer, asyncOptions?: AsyncOptions): Promise<ThumbHashResult>;
|
|
604
|
+
/**
|
|
605
|
+
* Generate thumbhash from image synchronously
|
|
606
|
+
*/
|
|
607
|
+
declare function thumbhashSync(input: Buffer): ThumbHashResult;
|
|
608
|
+
/**
|
|
609
|
+
* Decode thumbhash back to RGBA pixels asynchronously
|
|
610
|
+
*
|
|
611
|
+
* @param hash - ThumbHash bytes
|
|
612
|
+
* @param asyncOptions - Timeout and cancellation options
|
|
613
|
+
* @returns Promise resolving to RGBA pixels and dimensions
|
|
614
|
+
*/
|
|
615
|
+
declare function thumbhashToRgba(hash: Buffer, asyncOptions?: AsyncOptions): Promise<ThumbHashDecodeResult>;
|
|
616
|
+
/**
|
|
617
|
+
* Decode thumbhash back to RGBA pixels synchronously
|
|
618
|
+
*/
|
|
619
|
+
declare function thumbhashToRgbaSync(hash: Buffer): ThumbHashDecodeResult;
|
|
620
|
+
/**
|
|
621
|
+
* Convert thumbhash to data URL (helper function)
|
|
622
|
+
*
|
|
623
|
+
* @param hash - ThumbHash bytes
|
|
624
|
+
* @returns Base64 data URL string
|
|
625
|
+
*/
|
|
626
|
+
declare function thumbhashToDataUrl(hash: Buffer): string;
|
|
627
|
+
/**
|
|
628
|
+
* EXIF metadata API functions
|
|
629
|
+
*/
|
|
630
|
+
/**
|
|
631
|
+
* Write EXIF metadata to an image asynchronously
|
|
632
|
+
*
|
|
633
|
+
* Supports JPEG and WebP formats.
|
|
634
|
+
*
|
|
635
|
+
* @param input - Image buffer
|
|
636
|
+
* @param options - EXIF metadata options
|
|
637
|
+
* @param asyncOptions - Timeout and cancellation options
|
|
638
|
+
* @returns Promise resolving to image buffer with EXIF data
|
|
639
|
+
*/
|
|
640
|
+
declare function writeExif(input: Buffer, options: ExifOptions, asyncOptions?: AsyncOptions): Promise<Buffer>;
|
|
641
|
+
/**
|
|
642
|
+
* Write EXIF metadata to an image synchronously
|
|
643
|
+
*/
|
|
644
|
+
declare function writeExifSync(input: Buffer, options: ExifOptions): Buffer;
|
|
645
|
+
/**
|
|
646
|
+
* Strip all EXIF metadata from an image asynchronously
|
|
647
|
+
*
|
|
648
|
+
* Supports JPEG and WebP formats.
|
|
649
|
+
*
|
|
650
|
+
* @param input - Image buffer
|
|
651
|
+
* @param asyncOptions - Timeout and cancellation options
|
|
652
|
+
* @returns Promise resolving to image buffer without EXIF data
|
|
653
|
+
*/
|
|
654
|
+
declare function stripExif(input: Buffer, asyncOptions?: AsyncOptions): Promise<Buffer>;
|
|
655
|
+
/**
|
|
656
|
+
* Strip all EXIF metadata from an image synchronously
|
|
657
|
+
*/
|
|
658
|
+
declare function stripExifSync(input: Buffer): Buffer;
|
|
659
|
+
/**
|
|
660
|
+
* Tensor conversion API
|
|
661
|
+
* Convert images to tensor format for ML frameworks
|
|
662
|
+
*/
|
|
663
|
+
/**
|
|
664
|
+
* Enhanced tensor result with helper methods
|
|
665
|
+
*/
|
|
666
|
+
interface EnhancedTensorResult extends TensorResult {
|
|
667
|
+
/** Convert data to Float32Array (for Float32 dtype) */
|
|
668
|
+
toFloat32Array(): Float32Array;
|
|
669
|
+
/** Convert data to Uint8Array (for Uint8 dtype) */
|
|
670
|
+
toUint8Array(): Uint8Array;
|
|
671
|
+
}
|
|
672
|
+
/**
|
|
673
|
+
* Convert image to tensor format for ML frameworks
|
|
674
|
+
*
|
|
675
|
+
* @param input - Image buffer (JPEG, PNG, WebP, etc.)
|
|
676
|
+
* @param options - Tensor conversion options
|
|
677
|
+
* @param asyncOptions - Timeout and cancellation options
|
|
678
|
+
* @returns Tensor data with shape and metadata
|
|
679
|
+
*/
|
|
680
|
+
declare function toTensor(input: Buffer, options?: TensorOptions, asyncOptions?: AsyncOptions): Promise<EnhancedTensorResult>;
|
|
681
|
+
/**
|
|
682
|
+
* Convert image to tensor format synchronously
|
|
683
|
+
*/
|
|
684
|
+
declare function toTensorSync(input: Buffer, options?: TensorOptions): EnhancedTensorResult;
|
|
685
|
+
/**
|
|
686
|
+
* Perceptual hashing API for image similarity detection
|
|
687
|
+
*/
|
|
688
|
+
/**
|
|
689
|
+
* Generate a perceptual hash from an image asynchronously
|
|
690
|
+
*
|
|
691
|
+
* @param input - Image buffer (JPEG, PNG, WebP, etc.)
|
|
692
|
+
* @param options - Hash options (algorithm, size)
|
|
693
|
+
* @param asyncOptions - Timeout and cancellation options
|
|
694
|
+
* @returns Promise resolving to ImageHashResult with hash string
|
|
695
|
+
*
|
|
696
|
+
* @example
|
|
697
|
+
* ```typescript
|
|
698
|
+
* const result = await imageHash(buffer);
|
|
699
|
+
*
|
|
700
|
+
* // With timeout
|
|
701
|
+
* const result = await imageHash(buffer, { algorithm: 'PHash' }, { timeoutMs: 5000 });
|
|
702
|
+
* ```
|
|
703
|
+
*/
|
|
704
|
+
declare function imageHash(input: Buffer, options?: ImageHashOptions, asyncOptions?: AsyncOptions): Promise<ImageHashResult>;
|
|
705
|
+
/**
|
|
706
|
+
* Generate a perceptual hash from an image synchronously
|
|
707
|
+
*/
|
|
708
|
+
declare function imageHashSync(input: Buffer, options?: ImageHashOptions): ImageHashResult;
|
|
709
|
+
/**
|
|
710
|
+
* Calculate the hamming distance between two perceptual hashes asynchronously
|
|
711
|
+
*
|
|
712
|
+
* @param hash1 - First hash (base64 string from imageHash)
|
|
713
|
+
* @param hash2 - Second hash (base64 string from imageHash)
|
|
714
|
+
* @param asyncOptions - Timeout and cancellation options
|
|
715
|
+
* @returns Promise resolving to hamming distance
|
|
716
|
+
*/
|
|
717
|
+
declare function imageHashDistance(hash1: string, hash2: string, asyncOptions?: AsyncOptions): Promise<number>;
|
|
718
|
+
/**
|
|
719
|
+
* Calculate the hamming distance between two perceptual hashes synchronously
|
|
720
|
+
*/
|
|
721
|
+
declare function imageHashDistanceSync(hash1: string, hash2: string): number;
|
|
722
|
+
/**
|
|
723
|
+
* Smart Crop API for content-aware image cropping
|
|
724
|
+
*/
|
|
725
|
+
/**
|
|
726
|
+
* Smart crop an image using content-aware detection asynchronously
|
|
727
|
+
*
|
|
728
|
+
* @param input - Image buffer (JPEG, PNG, WebP, etc.)
|
|
729
|
+
* @param options - Smart crop options (width, height, or aspectRatio)
|
|
730
|
+
* @param asyncOptions - Timeout and cancellation options
|
|
731
|
+
* @returns Promise resolving to cropped image buffer (PNG format)
|
|
732
|
+
*/
|
|
733
|
+
declare function smartCrop(input: Buffer, options: SmartCropOptions, asyncOptions?: AsyncOptions): Promise<Buffer>;
|
|
734
|
+
/**
|
|
735
|
+
* Smart crop an image using content-aware detection synchronously
|
|
736
|
+
*/
|
|
737
|
+
declare function smartCropSync(input: Buffer, options: SmartCropOptions): Buffer;
|
|
738
|
+
/**
|
|
739
|
+
* Analyze an image and find the best crop region asynchronously
|
|
740
|
+
*
|
|
741
|
+
* @param input - Image buffer (JPEG, PNG, WebP, etc.)
|
|
742
|
+
* @param options - Smart crop options (width, height, or aspectRatio)
|
|
743
|
+
* @param asyncOptions - Timeout and cancellation options
|
|
744
|
+
* @returns Promise resolving to SmartCropAnalysis with crop coordinates and score
|
|
745
|
+
*/
|
|
746
|
+
declare function smartCropAnalyze(input: Buffer, options: SmartCropOptions, asyncOptions?: AsyncOptions): Promise<SmartCropAnalysis>;
|
|
747
|
+
/**
|
|
748
|
+
* Analyze an image and find the best crop region synchronously
|
|
749
|
+
*/
|
|
750
|
+
declare function smartCropAnalyzeSync(input: Buffer, options: SmartCropOptions): SmartCropAnalysis;
|
|
751
|
+
/**
|
|
752
|
+
* Dominant Color Extraction API
|
|
753
|
+
*/
|
|
754
|
+
/**
|
|
755
|
+
* Extract dominant colors from an image asynchronously
|
|
756
|
+
*
|
|
757
|
+
* @param input - Image buffer (JPEG, PNG, WebP, etc.)
|
|
758
|
+
* @param count - Maximum number of colors to extract (default: 5)
|
|
759
|
+
* @param asyncOptions - Timeout and cancellation options
|
|
760
|
+
* @returns Promise resolving to DominantColorsResult with colors array and primary color
|
|
761
|
+
*/
|
|
762
|
+
declare function dominantColors(input: Buffer, count?: number, asyncOptions?: AsyncOptions): Promise<DominantColorsResult>;
|
|
763
|
+
/**
|
|
764
|
+
* Extract dominant colors from an image synchronously
|
|
765
|
+
*/
|
|
766
|
+
declare function dominantColorsSync(input: Buffer, count?: number): DominantColorsResult;
|
|
767
|
+
/**
|
|
768
|
+
* Fast Thumbnail API
|
|
769
|
+
*
|
|
770
|
+
* Optimized thumbnail generation with shrink-on-load support.
|
|
771
|
+
*/
|
|
772
|
+
/**
|
|
773
|
+
* Generate a fast thumbnail synchronously
|
|
774
|
+
*/
|
|
775
|
+
declare function thumbnailSync(input: Buffer, options: ThumbnailOptions): ThumbnailResult;
|
|
776
|
+
/**
|
|
777
|
+
* Generate a fast thumbnail asynchronously
|
|
778
|
+
*
|
|
779
|
+
* @param input - Image buffer (JPEG, PNG, WebP, etc.)
|
|
780
|
+
* @param options - Thumbnail options
|
|
781
|
+
* @param asyncOptions - Timeout and cancellation options
|
|
782
|
+
* @returns Promise resolving to thumbnail result with image data and metadata
|
|
783
|
+
*/
|
|
784
|
+
declare function thumbnail(input: Buffer, options: ThumbnailOptions, asyncOptions?: AsyncOptions): Promise<ThumbnailResult>;
|
|
785
|
+
/**
|
|
786
|
+
* Generate a fast thumbnail and return just the buffer synchronously
|
|
787
|
+
*/
|
|
788
|
+
declare function thumbnailBufferSync(input: Buffer, options: ThumbnailOptions): Buffer;
|
|
789
|
+
/**
|
|
790
|
+
* Generate a fast thumbnail and return just the buffer asynchronously
|
|
791
|
+
*
|
|
792
|
+
* @param input - Image buffer
|
|
793
|
+
* @param options - Thumbnail options
|
|
794
|
+
* @param asyncOptions - Timeout and cancellation options
|
|
795
|
+
* @returns Promise resolving to image buffer
|
|
796
|
+
*/
|
|
797
|
+
declare function thumbnailBuffer(input: Buffer, options: ThumbnailOptions, asyncOptions?: AsyncOptions): Promise<Buffer>;
|
|
798
|
+
/**
|
|
799
|
+
* imgkit - High-performance image processing for Bun and Node.js
|
|
800
|
+
*
|
|
801
|
+
* @module imgkit
|
|
802
|
+
* @author Aissam Irhir <aissamirhir@gmail.com>
|
|
803
|
+
*
|
|
804
|
+
* @example
|
|
805
|
+
* ```typescript
|
|
806
|
+
* import { resize, toWebp, metadata } from 'imgkit';
|
|
807
|
+
*
|
|
808
|
+
* // Read image
|
|
809
|
+
* const input = await Bun.file('input.jpg').arrayBuffer();
|
|
810
|
+
*
|
|
811
|
+
* // Resize image
|
|
812
|
+
* const resized = await resize(Buffer.from(input), { width: 800, height: 600 });
|
|
813
|
+
*
|
|
814
|
+
* // Convert to WebP
|
|
815
|
+
* const webp = await toWebp(Buffer.from(input), { quality: 85 });
|
|
816
|
+
*
|
|
817
|
+
* // Get metadata
|
|
818
|
+
* const info = await metadata(Buffer.from(input));
|
|
819
|
+
* console.log(info.width, info.height, info.format);
|
|
820
|
+
* ```
|
|
821
|
+
*/
|
|
822
|
+
/**
|
|
823
|
+
* Get library version
|
|
824
|
+
*/
|
|
825
|
+
declare function version(): string;
|
|
826
|
+
declare const _default: {
|
|
827
|
+
metadata: typeof metadata;
|
|
828
|
+
metadataSync: typeof metadataSync;
|
|
829
|
+
resize: typeof resize;
|
|
830
|
+
resizeSync: typeof resizeSync;
|
|
831
|
+
crop: typeof crop;
|
|
832
|
+
cropSync: typeof cropSync;
|
|
833
|
+
toJpeg: typeof toJpeg;
|
|
834
|
+
toJpegSync: typeof toJpegSync;
|
|
835
|
+
toPng: typeof toPng;
|
|
836
|
+
toPngSync: typeof toPngSync;
|
|
837
|
+
toWebp: typeof toWebp;
|
|
838
|
+
toWebpSync: typeof toWebpSync;
|
|
839
|
+
transform: typeof transform;
|
|
840
|
+
transformSync: typeof transformSync;
|
|
841
|
+
blurhash: typeof blurhash;
|
|
842
|
+
blurhashSync: typeof blurhashSync;
|
|
843
|
+
thumbhash: typeof thumbhash;
|
|
844
|
+
thumbhashSync: typeof thumbhashSync;
|
|
845
|
+
thumbhashToRgba: typeof thumbhashToRgba;
|
|
846
|
+
thumbhashToRgbaSync: typeof thumbhashToRgbaSync;
|
|
847
|
+
thumbhashToDataUrl: typeof thumbhashToDataUrl;
|
|
848
|
+
writeExif: typeof writeExif;
|
|
849
|
+
writeExifSync: typeof writeExifSync;
|
|
850
|
+
stripExif: typeof stripExif;
|
|
851
|
+
stripExifSync: typeof stripExifSync;
|
|
852
|
+
toTensor: typeof toTensor;
|
|
853
|
+
toTensorSync: typeof toTensorSync;
|
|
854
|
+
imageHash: typeof imageHash;
|
|
855
|
+
imageHashSync: typeof imageHashSync;
|
|
856
|
+
imageHashDistance: typeof imageHashDistance;
|
|
857
|
+
imageHashDistanceSync: typeof imageHashDistanceSync;
|
|
858
|
+
smartCrop: typeof smartCrop;
|
|
859
|
+
smartCropSync: typeof smartCropSync;
|
|
860
|
+
smartCropAnalyze: typeof smartCropAnalyze;
|
|
861
|
+
smartCropAnalyzeSync: typeof smartCropAnalyzeSync;
|
|
862
|
+
dominantColors: typeof dominantColors;
|
|
863
|
+
dominantColorsSync: typeof dominantColorsSync;
|
|
864
|
+
thumbnail: typeof thumbnail;
|
|
865
|
+
thumbnailSync: typeof thumbnailSync;
|
|
866
|
+
thumbnailBuffer: typeof thumbnailBuffer;
|
|
867
|
+
thumbnailBufferSync: typeof thumbnailBufferSync;
|
|
868
|
+
version: typeof version;
|
|
869
|
+
};
|
|
870
|
+
interface ImgkitConverterOptions extends exports_index_d.TransformOptions {}
|
|
871
|
+
declare class ImgkitConverter extends BaseConverter<ConvertInput, ConvertOutput> {
|
|
872
|
+
private readonly options?;
|
|
873
|
+
constructor(options?: ImgkitConverterOptions | undefined);
|
|
874
|
+
supports(input: ConvertInput): Promise<boolean>;
|
|
875
|
+
handle(input: ConvertInput): Promise<ConvertOutput>;
|
|
876
|
+
}
|
|
877
|
+
export { ImgkitConverter };
|