lightdrift-libraw 1.0.0-alpha.5 → 1.0.0-alpha.6
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/lib/index.d.ts +641 -647
- package/lib/index.js +46 -21
- package/package.json +1 -1
package/lib/index.d.ts
CHANGED
|
@@ -1,647 +1,641 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* TypeScript definitions for LibRaw Node.js wrapper
|
|
3
|
-
* Provides type-safe access to LibRaw functionality for RAW image processing
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
}
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
}
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
}
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
}
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
getCapabilities(): number;
|
|
643
|
-
getCameraList(): string[];
|
|
644
|
-
getCameraCount(): number;
|
|
645
|
-
};
|
|
646
|
-
|
|
647
|
-
export = LibRaw;
|
|
1
|
+
/**
|
|
2
|
+
* TypeScript definitions for LibRaw Node.js wrapper
|
|
3
|
+
* Provides type-safe access to LibRaw functionality for RAW image processing
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
declare module 'libraw' {
|
|
7
|
+
export interface LibRawMetadata {
|
|
8
|
+
/** Camera manufacturer */
|
|
9
|
+
make?: string;
|
|
10
|
+
/** Camera model */
|
|
11
|
+
model?: string;
|
|
12
|
+
/** Camera software/firmware */
|
|
13
|
+
software?: string;
|
|
14
|
+
/** Processed image width */
|
|
15
|
+
width: number;
|
|
16
|
+
/** Processed image height */
|
|
17
|
+
height: number;
|
|
18
|
+
/** RAW image width */
|
|
19
|
+
rawWidth: number;
|
|
20
|
+
/** RAW image height */
|
|
21
|
+
rawHeight: number;
|
|
22
|
+
/** Number of color channels */
|
|
23
|
+
colors: number;
|
|
24
|
+
/** Color filter array pattern */
|
|
25
|
+
filters: number;
|
|
26
|
+
/** ISO sensitivity */
|
|
27
|
+
iso?: number;
|
|
28
|
+
/** Shutter speed in seconds */
|
|
29
|
+
shutterSpeed?: number;
|
|
30
|
+
/** Aperture value (f-number) */
|
|
31
|
+
aperture?: number;
|
|
32
|
+
/** Focal length in mm */
|
|
33
|
+
focalLength?: number;
|
|
34
|
+
/** Timestamp of image capture */
|
|
35
|
+
timestamp?: number;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export interface LibRawAdvancedMetadata {
|
|
39
|
+
/** Normalized camera manufacturer */
|
|
40
|
+
normalizedMake?: string;
|
|
41
|
+
/** Normalized camera model */
|
|
42
|
+
normalizedModel?: string;
|
|
43
|
+
/** Number of RAW images in file */
|
|
44
|
+
rawCount: number;
|
|
45
|
+
/** DNG version number */
|
|
46
|
+
dngVersion: number;
|
|
47
|
+
/** Foveon sensor indicator */
|
|
48
|
+
is_foveon: number;
|
|
49
|
+
/** Color transformation matrix (4x3) */
|
|
50
|
+
colorMatrix: number[][];
|
|
51
|
+
/** Camera white balance multipliers */
|
|
52
|
+
camMul: number[];
|
|
53
|
+
/** Preprocessing multipliers */
|
|
54
|
+
preMul: number[];
|
|
55
|
+
/** Sensor black level */
|
|
56
|
+
blackLevel: number;
|
|
57
|
+
/** Maximum data value */
|
|
58
|
+
dataMaximum: number;
|
|
59
|
+
/** Sensor white level */
|
|
60
|
+
whiteLevel: number;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export interface LibRawImageSize {
|
|
64
|
+
/** Processed image width */
|
|
65
|
+
width: number;
|
|
66
|
+
/** Processed image height */
|
|
67
|
+
height: number;
|
|
68
|
+
/** RAW image width */
|
|
69
|
+
rawWidth: number;
|
|
70
|
+
/** RAW image height */
|
|
71
|
+
rawHeight: number;
|
|
72
|
+
/** Top margin in pixels */
|
|
73
|
+
topMargin: number;
|
|
74
|
+
/** Left margin in pixels */
|
|
75
|
+
leftMargin: number;
|
|
76
|
+
/** Internal width */
|
|
77
|
+
iWidth: number;
|
|
78
|
+
/** Internal height */
|
|
79
|
+
iHeight: number;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
export interface LibRawLensInfo {
|
|
83
|
+
/** Lens name/model */
|
|
84
|
+
lensName?: string;
|
|
85
|
+
/** Lens manufacturer */
|
|
86
|
+
lensMake?: string;
|
|
87
|
+
/** Lens serial number */
|
|
88
|
+
lensSerial?: string;
|
|
89
|
+
/** Internal lens serial number */
|
|
90
|
+
internalLensSerial?: string;
|
|
91
|
+
/** Minimum focal length */
|
|
92
|
+
minFocal?: number;
|
|
93
|
+
/** Maximum focal length */
|
|
94
|
+
maxFocal?: number;
|
|
95
|
+
/** Maximum aperture at minimum focal length */
|
|
96
|
+
maxAp4MinFocal?: number;
|
|
97
|
+
/** Maximum aperture at maximum focal length */
|
|
98
|
+
maxAp4MaxFocal?: number;
|
|
99
|
+
/** EXIF maximum aperture */
|
|
100
|
+
exifMaxAp?: number;
|
|
101
|
+
/** Focal length in 35mm equivalent */
|
|
102
|
+
focalLengthIn35mmFormat?: number;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
export interface LibRawColorInfo {
|
|
106
|
+
/** Number of color channels */
|
|
107
|
+
colors: number;
|
|
108
|
+
/** Color filter array pattern */
|
|
109
|
+
filters: number;
|
|
110
|
+
/** Sensor black level */
|
|
111
|
+
blackLevel: number;
|
|
112
|
+
/** Maximum data value */
|
|
113
|
+
dataMaximum: number;
|
|
114
|
+
/** Sensor white level */
|
|
115
|
+
whiteLevel: number;
|
|
116
|
+
/** Color profile length */
|
|
117
|
+
profileLength?: number;
|
|
118
|
+
/** RGB to camera space matrix (3x4) */
|
|
119
|
+
rgbCam: number[][];
|
|
120
|
+
/** Camera white balance multipliers */
|
|
121
|
+
camMul: number[];
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
export interface LibRawOutputParams {
|
|
125
|
+
/** Gamma correction curve [gamma, toe_slope] */
|
|
126
|
+
gamma?: [number, number];
|
|
127
|
+
/** Brightness adjustment (0.25-8.0) */
|
|
128
|
+
bright?: number;
|
|
129
|
+
/** Output color space (0=raw, 1=sRGB, 2=Adobe, 3=Wide, 4=ProPhoto, 5=XYZ, 6=ACES) */
|
|
130
|
+
output_color?: number;
|
|
131
|
+
/** Output bits per sample (8 or 16) */
|
|
132
|
+
output_bps?: number;
|
|
133
|
+
/** Manual white balance multipliers [R, G, B, G2] */
|
|
134
|
+
user_mul?: [number, number, number, number];
|
|
135
|
+
/** Disable automatic brightness adjustment */
|
|
136
|
+
no_auto_bright?: boolean;
|
|
137
|
+
/** Highlight recovery mode (0-9) */
|
|
138
|
+
highlight?: number;
|
|
139
|
+
/** Output TIFF format instead of PPM */
|
|
140
|
+
output_tiff?: boolean;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
export interface LibRawImageData {
|
|
144
|
+
/** Image type (1=JPEG, 3=PPM/TIFF) */
|
|
145
|
+
type: number;
|
|
146
|
+
/** Image height in pixels */
|
|
147
|
+
height: number;
|
|
148
|
+
/** Image width in pixels */
|
|
149
|
+
width: number;
|
|
150
|
+
/** Number of color channels */
|
|
151
|
+
colors: number;
|
|
152
|
+
/** Bits per channel */
|
|
153
|
+
bits: number;
|
|
154
|
+
/** Total data size in bytes */
|
|
155
|
+
dataSize: number;
|
|
156
|
+
/** Raw image data buffer */
|
|
157
|
+
data: Buffer;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
export interface LibRawJPEGOptions {
|
|
161
|
+
/** JPEG quality (1-100) */
|
|
162
|
+
quality?: number;
|
|
163
|
+
/** Target width (maintains aspect ratio if height not specified) */
|
|
164
|
+
width?: number;
|
|
165
|
+
/** Target height (maintains aspect ratio if width not specified) */
|
|
166
|
+
height?: number;
|
|
167
|
+
/** Use progressive JPEG */
|
|
168
|
+
progressive?: boolean;
|
|
169
|
+
/** Use mozjpeg encoder for better compression */
|
|
170
|
+
mozjpeg?: boolean;
|
|
171
|
+
/** Chroma subsampling ('4:4:4', '4:2:0') - Note: 4:2:2 maps to 4:4:4 */
|
|
172
|
+
chromaSubsampling?: '4:4:4' | '4:2:2' | '4:2:0';
|
|
173
|
+
/** Enable trellis quantisation */
|
|
174
|
+
trellisQuantisation?: boolean;
|
|
175
|
+
/** Optimize scan order */
|
|
176
|
+
optimizeScans?: boolean;
|
|
177
|
+
/** Overshoot deringing */
|
|
178
|
+
overshootDeringing?: boolean;
|
|
179
|
+
/** Optimize Huffman coding */
|
|
180
|
+
optimizeCoding?: boolean;
|
|
181
|
+
/** Output color space */
|
|
182
|
+
colorSpace?: 'srgb' | 'rec2020' | 'p3' | 'cmyk';
|
|
183
|
+
/** Enable fast mode for better performance */
|
|
184
|
+
fastMode?: boolean;
|
|
185
|
+
/** Encoding effort (1=fastest, 9=slowest) */
|
|
186
|
+
effort?: number;
|
|
187
|
+
/** Maximum concurrency for batch operations */
|
|
188
|
+
maxConcurrency?: number;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
export interface LibRawOptimalSettings {
|
|
192
|
+
quality: number;
|
|
193
|
+
progressive: boolean;
|
|
194
|
+
mozjpeg: boolean;
|
|
195
|
+
chromaSubsampling: string;
|
|
196
|
+
effort: number;
|
|
197
|
+
reasoning: string;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
export interface LibRawBufferResult {
|
|
201
|
+
/** Buffer creation success status */
|
|
202
|
+
success: boolean;
|
|
203
|
+
/** Raw binary data buffer */
|
|
204
|
+
buffer: Buffer;
|
|
205
|
+
/** Buffer metadata */
|
|
206
|
+
metadata: {
|
|
207
|
+
/** Original image dimensions */
|
|
208
|
+
originalDimensions?: {
|
|
209
|
+
width: number;
|
|
210
|
+
height: number;
|
|
211
|
+
};
|
|
212
|
+
/** Output image dimensions */
|
|
213
|
+
outputDimensions?: {
|
|
214
|
+
width: number;
|
|
215
|
+
height: number;
|
|
216
|
+
};
|
|
217
|
+
/** Processed dimensions */
|
|
218
|
+
dimensions?: {
|
|
219
|
+
width: number;
|
|
220
|
+
height: number;
|
|
221
|
+
};
|
|
222
|
+
/** File size information */
|
|
223
|
+
fileSize: {
|
|
224
|
+
original?: number;
|
|
225
|
+
compressed: number;
|
|
226
|
+
compressionRatio?: string;
|
|
227
|
+
};
|
|
228
|
+
/** Processing performance */
|
|
229
|
+
processing: {
|
|
230
|
+
timeMs: string;
|
|
231
|
+
throughputMBps?: string;
|
|
232
|
+
fromCache?: boolean;
|
|
233
|
+
};
|
|
234
|
+
/** Format-specific options */
|
|
235
|
+
jpegOptions?: object;
|
|
236
|
+
pngOptions?: object;
|
|
237
|
+
tiffOptions?: object;
|
|
238
|
+
webpOptions?: object;
|
|
239
|
+
avifOptions?: object;
|
|
240
|
+
/** Format type */
|
|
241
|
+
format?: string;
|
|
242
|
+
};
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
export interface LibRawImageConversionOptions {
|
|
246
|
+
/** Target width (maintains aspect ratio if height not specified) */
|
|
247
|
+
width?: number;
|
|
248
|
+
/** Target height (maintains aspect ratio if width not specified) */
|
|
249
|
+
height?: number;
|
|
250
|
+
/** Output color space */
|
|
251
|
+
colorSpace?: 'srgb' | 'rec2020' | 'p3' | 'cmyk';
|
|
252
|
+
/** Enable fast mode for better performance */
|
|
253
|
+
fastMode?: boolean;
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
export interface LibRawPNGOptions extends LibRawImageConversionOptions {
|
|
257
|
+
/** PNG compression level (0-9) */
|
|
258
|
+
compressionLevel?: number;
|
|
259
|
+
/** Use progressive PNG */
|
|
260
|
+
progressive?: boolean;
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
export interface LibRawTIFFOptions extends LibRawImageConversionOptions {
|
|
264
|
+
/** TIFF compression type */
|
|
265
|
+
compression?: 'none' | 'lzw' | 'jpeg' | 'zip';
|
|
266
|
+
/** JPEG quality when using JPEG compression */
|
|
267
|
+
quality?: number;
|
|
268
|
+
/** Create pyramidal TIFF */
|
|
269
|
+
pyramid?: boolean;
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
export interface LibRawWebPOptions extends LibRawImageConversionOptions {
|
|
273
|
+
/** WebP quality (1-100) */
|
|
274
|
+
quality?: number;
|
|
275
|
+
/** Use lossless WebP */
|
|
276
|
+
lossless?: boolean;
|
|
277
|
+
/** Encoding effort (0-6) */
|
|
278
|
+
effort?: number;
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
export interface LibRawAVIFOptions extends LibRawImageConversionOptions {
|
|
282
|
+
/** AVIF quality (1-100) */
|
|
283
|
+
quality?: number;
|
|
284
|
+
/** Use lossless AVIF */
|
|
285
|
+
lossless?: boolean;
|
|
286
|
+
/** Encoding effort (0-9) */
|
|
287
|
+
effort?: number;
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
export interface LibRawThumbnailJPEGOptions {
|
|
291
|
+
/** JPEG quality (1-100) */
|
|
292
|
+
quality?: number;
|
|
293
|
+
/** Maximum dimension size */
|
|
294
|
+
maxSize?: number;
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
export interface LibRawJPEGResult {
|
|
298
|
+
/** Conversion success status */
|
|
299
|
+
success: boolean;
|
|
300
|
+
/** Output file path */
|
|
301
|
+
outputPath: string;
|
|
302
|
+
/** Conversion metadata */
|
|
303
|
+
metadata: {
|
|
304
|
+
/** Original image dimensions */
|
|
305
|
+
originalDimensions: {
|
|
306
|
+
width: number;
|
|
307
|
+
height: number;
|
|
308
|
+
};
|
|
309
|
+
/** Output image dimensions */
|
|
310
|
+
outputDimensions: {
|
|
311
|
+
width: number;
|
|
312
|
+
height: number;
|
|
313
|
+
};
|
|
314
|
+
/** File size information */
|
|
315
|
+
fileSize: {
|
|
316
|
+
original: number;
|
|
317
|
+
compressed: number;
|
|
318
|
+
compressionRatio: string;
|
|
319
|
+
};
|
|
320
|
+
/** Processing performance */
|
|
321
|
+
processing: {
|
|
322
|
+
timeMs: string;
|
|
323
|
+
throughputMBps: string;
|
|
324
|
+
};
|
|
325
|
+
/** Applied JPEG options */
|
|
326
|
+
jpegOptions: object;
|
|
327
|
+
};
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
export interface LibRawBatchResult {
|
|
331
|
+
/** Successfully processed files */
|
|
332
|
+
successful: Array<{
|
|
333
|
+
input: string;
|
|
334
|
+
output: string;
|
|
335
|
+
result: LibRawJPEGResult;
|
|
336
|
+
}>;
|
|
337
|
+
/** Failed files */
|
|
338
|
+
failed: Array<{
|
|
339
|
+
input: string;
|
|
340
|
+
error: string;
|
|
341
|
+
}>;
|
|
342
|
+
/** Processing summary */
|
|
343
|
+
summary: {
|
|
344
|
+
total: number;
|
|
345
|
+
processed: number;
|
|
346
|
+
errors: number;
|
|
347
|
+
totalProcessingTime: number;
|
|
348
|
+
averageCompressionRatio: string;
|
|
349
|
+
totalOriginalSize: number;
|
|
350
|
+
totalCompressedSize: number;
|
|
351
|
+
averageProcessingTimePerFile: string;
|
|
352
|
+
};
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
export interface LibRawOptimalSettings {
|
|
356
|
+
/** Recommended JPEG settings */
|
|
357
|
+
recommended: LibRawJPEGOptions & {
|
|
358
|
+
reasoning: string[];
|
|
359
|
+
};
|
|
360
|
+
/** Image analysis results */
|
|
361
|
+
imageAnalysis: {
|
|
362
|
+
dimensions: {
|
|
363
|
+
width: number;
|
|
364
|
+
height: number;
|
|
365
|
+
area: number;
|
|
366
|
+
};
|
|
367
|
+
category: 'high-resolution' | 'medium-resolution' | 'low-resolution';
|
|
368
|
+
camera: {
|
|
369
|
+
make?: string;
|
|
370
|
+
model?: string;
|
|
371
|
+
};
|
|
372
|
+
};
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
export class LibRaw {
|
|
376
|
+
constructor();
|
|
377
|
+
|
|
378
|
+
// ============== FILE OPERATIONS ==============
|
|
379
|
+
/**
|
|
380
|
+
* Load RAW image from file
|
|
381
|
+
* @param filename Path to RAW image file
|
|
382
|
+
*/
|
|
383
|
+
loadFile(filename: string): Promise<boolean>;
|
|
384
|
+
|
|
385
|
+
/**
|
|
386
|
+
* Load RAW image from buffer
|
|
387
|
+
* @param buffer Binary data buffer containing RAW image
|
|
388
|
+
*/
|
|
389
|
+
loadBuffer(buffer: Buffer): Promise<boolean>;
|
|
390
|
+
|
|
391
|
+
/**
|
|
392
|
+
* Close current image and free resources
|
|
393
|
+
*/
|
|
394
|
+
close(): Promise<boolean>;
|
|
395
|
+
|
|
396
|
+
// ============== METADATA & INFORMATION ==============
|
|
397
|
+
/**
|
|
398
|
+
* Get basic image metadata and EXIF information
|
|
399
|
+
*/
|
|
400
|
+
getMetadata(): Promise<LibRawMetadata>;
|
|
401
|
+
|
|
402
|
+
/**
|
|
403
|
+
* Get image size and margin information
|
|
404
|
+
*/
|
|
405
|
+
getImageSize(): Promise<LibRawImageSize>;
|
|
406
|
+
|
|
407
|
+
/**
|
|
408
|
+
* Get advanced metadata including color matrices
|
|
409
|
+
*/
|
|
410
|
+
getAdvancedMetadata(): Promise<LibRawAdvancedMetadata>;
|
|
411
|
+
|
|
412
|
+
/**
|
|
413
|
+
* Get lens information from EXIF data
|
|
414
|
+
*/
|
|
415
|
+
getLensInfo(): Promise<LibRawLensInfo>;
|
|
416
|
+
|
|
417
|
+
/**
|
|
418
|
+
* Get color space and sensor information
|
|
419
|
+
*/
|
|
420
|
+
getColorInfo(): Promise<LibRawColorInfo>;
|
|
421
|
+
|
|
422
|
+
// ============== IMAGE PROCESSING ==============
|
|
423
|
+
/**
|
|
424
|
+
* Unpack thumbnail from RAW file
|
|
425
|
+
*/
|
|
426
|
+
unpackThumbnail(): Promise<boolean>;
|
|
427
|
+
|
|
428
|
+
/**
|
|
429
|
+
* Process RAW image with current settings
|
|
430
|
+
*/
|
|
431
|
+
processImage(): Promise<boolean>;
|
|
432
|
+
|
|
433
|
+
/**
|
|
434
|
+
* Subtract black level from image data
|
|
435
|
+
*/
|
|
436
|
+
subtractBlack(): Promise<boolean>;
|
|
437
|
+
|
|
438
|
+
/**
|
|
439
|
+
* Convert RAW data to RGB image
|
|
440
|
+
*/
|
|
441
|
+
raw2Image(): Promise<boolean>;
|
|
442
|
+
|
|
443
|
+
/**
|
|
444
|
+
* Adjust image maximum values
|
|
445
|
+
*/
|
|
446
|
+
adjustMaximum(): Promise<boolean>;
|
|
447
|
+
|
|
448
|
+
// ============== MEMORY IMAGE CREATION ==============
|
|
449
|
+
/**
|
|
450
|
+
* Create processed image in memory
|
|
451
|
+
*/
|
|
452
|
+
createMemoryImage(): Promise<LibRawImageData>;
|
|
453
|
+
|
|
454
|
+
/**
|
|
455
|
+
* Create thumbnail image in memory
|
|
456
|
+
*/
|
|
457
|
+
createMemoryThumbnail(): Promise<LibRawImageData>;
|
|
458
|
+
|
|
459
|
+
// ============== FILE WRITERS ==============
|
|
460
|
+
/**
|
|
461
|
+
* Write processed image as PPM file
|
|
462
|
+
* @param filename Output PPM file path
|
|
463
|
+
*/
|
|
464
|
+
writePPM(filename: string): Promise<boolean>;
|
|
465
|
+
|
|
466
|
+
/**
|
|
467
|
+
* Write processed image as TIFF file
|
|
468
|
+
* @param filename Output TIFF file path
|
|
469
|
+
*/
|
|
470
|
+
writeTIFF(filename: string): Promise<boolean>;
|
|
471
|
+
|
|
472
|
+
/**
|
|
473
|
+
* Write thumbnail as JPEG file
|
|
474
|
+
* @param filename Output JPEG file path
|
|
475
|
+
*/
|
|
476
|
+
writeThumbnail(filename: string): Promise<boolean>;
|
|
477
|
+
|
|
478
|
+
// ============== CONFIGURATION & SETTINGS ==============
|
|
479
|
+
/**
|
|
480
|
+
* Set output processing parameters
|
|
481
|
+
* @param params Output parameters configuration
|
|
482
|
+
*/
|
|
483
|
+
setOutputParams(params: LibRawOutputParams): Promise<boolean>;
|
|
484
|
+
|
|
485
|
+
/**
|
|
486
|
+
* Get current output processing parameters
|
|
487
|
+
*/
|
|
488
|
+
getOutputParams(): Promise<LibRawOutputParams>;
|
|
489
|
+
|
|
490
|
+
// ============== UTILITY FUNCTIONS ==============
|
|
491
|
+
/**
|
|
492
|
+
* Check if image uses floating point values
|
|
493
|
+
*/
|
|
494
|
+
isFloatingPoint(): Promise<boolean>;
|
|
495
|
+
|
|
496
|
+
/**
|
|
497
|
+
* Check if image is from Fuji camera and rotated
|
|
498
|
+
*/
|
|
499
|
+
isFujiRotated(): Promise<boolean>;
|
|
500
|
+
|
|
501
|
+
/**
|
|
502
|
+
* Check if image is sRAW format
|
|
503
|
+
*/
|
|
504
|
+
isSRAW(): Promise<boolean>;
|
|
505
|
+
|
|
506
|
+
/**
|
|
507
|
+
* Check if file contains JPEG thumbnail
|
|
508
|
+
*/
|
|
509
|
+
isJPEGThumb(): Promise<boolean>;
|
|
510
|
+
|
|
511
|
+
/**
|
|
512
|
+
* Get current error count
|
|
513
|
+
*/
|
|
514
|
+
errorCount(): Promise<number>;
|
|
515
|
+
|
|
516
|
+
// ============== MEMORY STREAM OPERATIONS (NEW FEATURE) ==============
|
|
517
|
+
/**
|
|
518
|
+
* Create processed image as JPEG buffer in memory
|
|
519
|
+
* @param options JPEG conversion options
|
|
520
|
+
*/
|
|
521
|
+
createJPEGBuffer(options?: LibRawJPEGOptions): Promise<LibRawBufferResult>;
|
|
522
|
+
|
|
523
|
+
/**
|
|
524
|
+
* Create processed image as PNG buffer in memory
|
|
525
|
+
* @param options PNG conversion options
|
|
526
|
+
*/
|
|
527
|
+
createPNGBuffer(options?: LibRawPNGOptions): Promise<LibRawBufferResult>;
|
|
528
|
+
|
|
529
|
+
/**
|
|
530
|
+
* Create processed image as TIFF buffer in memory
|
|
531
|
+
* @param options TIFF conversion options
|
|
532
|
+
*/
|
|
533
|
+
createTIFFBuffer(options?: LibRawTIFFOptions): Promise<LibRawBufferResult>;
|
|
534
|
+
|
|
535
|
+
/**
|
|
536
|
+
* Create processed image as WebP buffer in memory
|
|
537
|
+
* @param options WebP conversion options
|
|
538
|
+
*/
|
|
539
|
+
createWebPBuffer(options?: LibRawWebPOptions): Promise<LibRawBufferResult>;
|
|
540
|
+
|
|
541
|
+
/**
|
|
542
|
+
* Create processed image as AVIF buffer in memory
|
|
543
|
+
* @param options AVIF conversion options
|
|
544
|
+
*/
|
|
545
|
+
createAVIFBuffer(options?: LibRawAVIFOptions): Promise<LibRawBufferResult>;
|
|
546
|
+
|
|
547
|
+
/**
|
|
548
|
+
* Create raw PPM buffer from processed image data
|
|
549
|
+
*/
|
|
550
|
+
createPPMBuffer(): Promise<LibRawBufferResult>;
|
|
551
|
+
|
|
552
|
+
/**
|
|
553
|
+
* Create thumbnail as JPEG buffer in memory
|
|
554
|
+
* @param options JPEG options for thumbnail
|
|
555
|
+
*/
|
|
556
|
+
createThumbnailJPEGBuffer(options?: LibRawThumbnailJPEGOptions): Promise<LibRawBufferResult>;
|
|
557
|
+
|
|
558
|
+
// ============== JPEG CONVERSION (NEW FEATURE) ==============
|
|
559
|
+
/**
|
|
560
|
+
* Convert RAW to JPEG with advanced options
|
|
561
|
+
* @param outputPath Output JPEG file path
|
|
562
|
+
* @param options JPEG conversion options
|
|
563
|
+
*/
|
|
564
|
+
convertToJPEG(outputPath: string, options?: LibRawJPEGOptions): Promise<LibRawJPEGResult>;
|
|
565
|
+
|
|
566
|
+
/**
|
|
567
|
+
* Batch convert multiple RAW files to JPEG
|
|
568
|
+
* @param inputPaths Array of input RAW file paths
|
|
569
|
+
* @param outputDir Output directory for JPEG files
|
|
570
|
+
* @param options JPEG conversion options
|
|
571
|
+
*/
|
|
572
|
+
batchConvertToJPEG(inputPaths: string[], outputDir: string, options?: LibRawJPEGOptions): Promise<LibRawBatchResult>;
|
|
573
|
+
|
|
574
|
+
/**
|
|
575
|
+
* Get optimal JPEG conversion settings based on image analysis
|
|
576
|
+
* @param analysisOptions Options for image analysis
|
|
577
|
+
*/
|
|
578
|
+
getOptimalJPEGSettings(analysisOptions?: { usage?: 'web' | 'print' | 'archive' }): Promise<LibRawOptimalSettings>;
|
|
579
|
+
|
|
580
|
+
/**
|
|
581
|
+
* High-performance JPEG conversion with minimal processing for speed
|
|
582
|
+
* @param outputPath Output JPEG file path
|
|
583
|
+
* @param options Speed-optimized JPEG options
|
|
584
|
+
*/
|
|
585
|
+
convertToJPEGFast(outputPath: string, options?: LibRawJPEGOptions): Promise<LibRawJPEGResult>;
|
|
586
|
+
|
|
587
|
+
/**
|
|
588
|
+
* Create multiple JPEG sizes from single RAW (thumbnail, web, full)
|
|
589
|
+
* @param baseOutputPath Base output path (without extension)
|
|
590
|
+
* @param options Multi-size options
|
|
591
|
+
*/
|
|
592
|
+
convertToJPEGMultiSize(baseOutputPath: string, options?: {
|
|
593
|
+
sizes?: Array<{
|
|
594
|
+
name: string;
|
|
595
|
+
width?: number;
|
|
596
|
+
height?: number;
|
|
597
|
+
quality?: number;
|
|
598
|
+
progressive?: boolean;
|
|
599
|
+
mozjpeg?: boolean;
|
|
600
|
+
chromaSubsampling?: string;
|
|
601
|
+
effort?: number;
|
|
602
|
+
}>;
|
|
603
|
+
}): Promise<{
|
|
604
|
+
success: boolean;
|
|
605
|
+
sizes: Record<string, {
|
|
606
|
+
name: string;
|
|
607
|
+
outputPath: string;
|
|
608
|
+
dimensions: { width: number; height: number };
|
|
609
|
+
fileSize: number;
|
|
610
|
+
processingTime: number;
|
|
611
|
+
config: any;
|
|
612
|
+
}>;
|
|
613
|
+
originalDimensions: { width: number; height: number };
|
|
614
|
+
totalProcessingTime: number;
|
|
615
|
+
averageTimePerSize: string;
|
|
616
|
+
}>;
|
|
617
|
+
|
|
618
|
+
// ============== STATIC METHODS ==============
|
|
619
|
+
/**
|
|
620
|
+
* Get LibRaw library version
|
|
621
|
+
*/
|
|
622
|
+
static getVersion(): string;
|
|
623
|
+
|
|
624
|
+
/**
|
|
625
|
+
* Get LibRaw library capabilities bitmask
|
|
626
|
+
*/
|
|
627
|
+
static getCapabilities(): number;
|
|
628
|
+
|
|
629
|
+
/**
|
|
630
|
+
* Get list of supported camera models
|
|
631
|
+
*/
|
|
632
|
+
static getCameraList(): string[];
|
|
633
|
+
|
|
634
|
+
/**
|
|
635
|
+
* Get count of supported camera models
|
|
636
|
+
*/
|
|
637
|
+
static getCameraCount(): number;
|
|
638
|
+
}
|
|
639
|
+
|
|
640
|
+
export = LibRaw;
|
|
641
|
+
}
|