lightdrift-libraw 1.0.0-alpha.1 → 1.0.0-alpha.2
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 +730 -374
- package/README.md +1032 -757
- package/lib/index.d.ts +178 -0
- package/lib/index.js +1358 -761
- package/package.json +50 -38
- package/src/libraw_wrapper_new.cpp +0 -853
package/lib/index.d.ts
CHANGED
|
@@ -157,6 +157,124 @@ declare module 'libraw' {
|
|
|
157
157
|
data: Buffer;
|
|
158
158
|
}
|
|
159
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 LibRawJPEGResult {
|
|
201
|
+
/** Conversion success status */
|
|
202
|
+
success: boolean;
|
|
203
|
+
/** Output file path */
|
|
204
|
+
outputPath: string;
|
|
205
|
+
/** Conversion 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
|
+
/** File size information */
|
|
218
|
+
fileSize: {
|
|
219
|
+
original: number;
|
|
220
|
+
compressed: number;
|
|
221
|
+
compressionRatio: string;
|
|
222
|
+
};
|
|
223
|
+
/** Processing performance */
|
|
224
|
+
processing: {
|
|
225
|
+
timeMs: string;
|
|
226
|
+
throughputMBps: string;
|
|
227
|
+
};
|
|
228
|
+
/** Applied JPEG options */
|
|
229
|
+
jpegOptions: object;
|
|
230
|
+
};
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
export interface LibRawBatchResult {
|
|
234
|
+
/** Successfully processed files */
|
|
235
|
+
successful: Array<{
|
|
236
|
+
input: string;
|
|
237
|
+
output: string;
|
|
238
|
+
result: LibRawJPEGResult;
|
|
239
|
+
}>;
|
|
240
|
+
/** Failed files */
|
|
241
|
+
failed: Array<{
|
|
242
|
+
input: string;
|
|
243
|
+
error: string;
|
|
244
|
+
}>;
|
|
245
|
+
/** Processing summary */
|
|
246
|
+
summary: {
|
|
247
|
+
total: number;
|
|
248
|
+
processed: number;
|
|
249
|
+
errors: number;
|
|
250
|
+
totalProcessingTime: number;
|
|
251
|
+
averageCompressionRatio: string;
|
|
252
|
+
totalOriginalSize: number;
|
|
253
|
+
totalCompressedSize: number;
|
|
254
|
+
averageProcessingTimePerFile: string;
|
|
255
|
+
};
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
export interface LibRawOptimalSettings {
|
|
259
|
+
/** Recommended JPEG settings */
|
|
260
|
+
recommended: LibRawJPEGOptions & {
|
|
261
|
+
reasoning: string[];
|
|
262
|
+
};
|
|
263
|
+
/** Image analysis results */
|
|
264
|
+
imageAnalysis: {
|
|
265
|
+
dimensions: {
|
|
266
|
+
width: number;
|
|
267
|
+
height: number;
|
|
268
|
+
area: number;
|
|
269
|
+
};
|
|
270
|
+
category: 'high-resolution' | 'medium-resolution' | 'low-resolution';
|
|
271
|
+
camera: {
|
|
272
|
+
make?: string;
|
|
273
|
+
model?: string;
|
|
274
|
+
};
|
|
275
|
+
};
|
|
276
|
+
}
|
|
277
|
+
|
|
160
278
|
export class LibRaw {
|
|
161
279
|
constructor();
|
|
162
280
|
|
|
@@ -298,6 +416,66 @@ declare module 'libraw' {
|
|
|
298
416
|
*/
|
|
299
417
|
errorCount(): Promise<number>;
|
|
300
418
|
|
|
419
|
+
// ============== JPEG CONVERSION (NEW FEATURE) ==============
|
|
420
|
+
/**
|
|
421
|
+
* Convert RAW to JPEG with advanced options
|
|
422
|
+
* @param outputPath Output JPEG file path
|
|
423
|
+
* @param options JPEG conversion options
|
|
424
|
+
*/
|
|
425
|
+
convertToJPEG(outputPath: string, options?: LibRawJPEGOptions): Promise<LibRawJPEGResult>;
|
|
426
|
+
|
|
427
|
+
/**
|
|
428
|
+
* Batch convert multiple RAW files to JPEG
|
|
429
|
+
* @param inputPaths Array of input RAW file paths
|
|
430
|
+
* @param outputDir Output directory for JPEG files
|
|
431
|
+
* @param options JPEG conversion options
|
|
432
|
+
*/
|
|
433
|
+
batchConvertToJPEG(inputPaths: string[], outputDir: string, options?: LibRawJPEGOptions): Promise<LibRawBatchResult>;
|
|
434
|
+
|
|
435
|
+
/**
|
|
436
|
+
* Get optimal JPEG conversion settings based on image analysis
|
|
437
|
+
* @param analysisOptions Options for image analysis
|
|
438
|
+
*/
|
|
439
|
+
getOptimalJPEGSettings(analysisOptions?: { usage?: 'web' | 'print' | 'archive' }): Promise<LibRawOptimalSettings>;
|
|
440
|
+
|
|
441
|
+
/**
|
|
442
|
+
* High-performance JPEG conversion with minimal processing for speed
|
|
443
|
+
* @param outputPath Output JPEG file path
|
|
444
|
+
* @param options Speed-optimized JPEG options
|
|
445
|
+
*/
|
|
446
|
+
convertToJPEGFast(outputPath: string, options?: LibRawJPEGOptions): Promise<LibRawJPEGResult>;
|
|
447
|
+
|
|
448
|
+
/**
|
|
449
|
+
* Create multiple JPEG sizes from single RAW (thumbnail, web, full)
|
|
450
|
+
* @param baseOutputPath Base output path (without extension)
|
|
451
|
+
* @param options Multi-size options
|
|
452
|
+
*/
|
|
453
|
+
convertToJPEGMultiSize(baseOutputPath: string, options?: {
|
|
454
|
+
sizes?: Array<{
|
|
455
|
+
name: string;
|
|
456
|
+
width?: number;
|
|
457
|
+
height?: number;
|
|
458
|
+
quality?: number;
|
|
459
|
+
progressive?: boolean;
|
|
460
|
+
mozjpeg?: boolean;
|
|
461
|
+
chromaSubsampling?: string;
|
|
462
|
+
effort?: number;
|
|
463
|
+
}>;
|
|
464
|
+
}): Promise<{
|
|
465
|
+
success: boolean;
|
|
466
|
+
sizes: Record<string, {
|
|
467
|
+
name: string;
|
|
468
|
+
outputPath: string;
|
|
469
|
+
dimensions: { width: number; height: number };
|
|
470
|
+
fileSize: number;
|
|
471
|
+
processingTime: number;
|
|
472
|
+
config: any;
|
|
473
|
+
}>;
|
|
474
|
+
originalDimensions: { width: number; height: number };
|
|
475
|
+
totalProcessingTime: number;
|
|
476
|
+
averageTimePerSize: string;
|
|
477
|
+
}>;
|
|
478
|
+
|
|
301
479
|
// ============== STATIC METHODS ==============
|
|
302
480
|
/**
|
|
303
481
|
* Get LibRaw library version
|