lightdrift-libraw 1.0.0-alpha.1 โ 1.0.0-alpha.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/CHANGELOG.md +1138 -374
- package/README.md +1290 -757
- package/lib/index.d.ts +317 -0
- package/lib/index.js +2224 -761
- package/package.json +51 -38
- package/src/libraw_wrapper_new.cpp +0 -853
package/CHANGELOG.md
CHANGED
|
@@ -1,374 +1,1138 @@
|
|
|
1
|
-
# Changelog
|
|
2
|
-
|
|
3
|
-
All notable changes to this project will be documented in this file.
|
|
4
|
-
|
|
5
|
-
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
|
-
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
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
|
-
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
|
|
8
|
+
# Changelog
|
|
9
|
+
|
|
10
|
+
All notable changes to this project will be documented in this file.
|
|
11
|
+
|
|
12
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
13
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
14
|
+
|
|
15
|
+
## [1.0.0-alpha.3] - 2025-08-30
|
|
16
|
+
|
|
17
|
+
### ๐ Major Feature Release - Buffer Creation API
|
|
18
|
+
|
|
19
|
+
This release introduces a comprehensive buffer creation system that enables direct memory buffer generation for multiple image formats without intermediate file operations. This addresses the core need for stream-based processing workflows.
|
|
20
|
+
|
|
21
|
+
### โจ Added
|
|
22
|
+
|
|
23
|
+
#### ๐ Complete Buffer Creation API (7 New Methods)
|
|
24
|
+
|
|
25
|
+
- **Direct Memory Buffer Creation**
|
|
26
|
+
|
|
27
|
+
- `createJPEGBuffer(options)` - JPEG buffers with quality, resize, and progressive options
|
|
28
|
+
- `createPNGBuffer(options)` - PNG buffers with compression levels and transparency
|
|
29
|
+
- `createWebPBuffer(options)` - Modern WebP format with lossy/lossless modes
|
|
30
|
+
- `createAVIFBuffer(options)` - Next-generation AVIF format with superior compression
|
|
31
|
+
- `createTIFFBuffer(options)` - Professional TIFF format with multiple compression options
|
|
32
|
+
- `createPPMBuffer()` - Raw PPM format for maximum compatibility
|
|
33
|
+
- `createThumbnailJPEGBuffer(options)` - Fast thumbnail extraction without full processing
|
|
34
|
+
|
|
35
|
+
- **Smart Processing Pipeline**
|
|
36
|
+
- Automatic processing detection and caching
|
|
37
|
+
- Shared processed image data for multiple format creation
|
|
38
|
+
- Memory-efficient buffer generation
|
|
39
|
+
- Intelligent resize and quality optimization
|
|
40
|
+
|
|
41
|
+
#### ๐ Advanced Image Processing Features
|
|
42
|
+
|
|
43
|
+
- **Flexible Resizing Options**
|
|
44
|
+
|
|
45
|
+
- Maintain aspect ratio with single dimension
|
|
46
|
+
- High-quality Lanczos3 resampling
|
|
47
|
+
- Optimized for both enlargement and reduction
|
|
48
|
+
- Automatic dimension calculation
|
|
49
|
+
|
|
50
|
+
- **Format-Specific Optimizations**
|
|
51
|
+
|
|
52
|
+
- **JPEG**: Progressive encoding, fast mode, quality optimization
|
|
53
|
+
- **PNG**: Compression levels (0-9), transparency preservation
|
|
54
|
+
- **WebP**: Lossless mode, effort control, fast compression
|
|
55
|
+
- **AVIF**: Advanced compression, lossless support, quality tuning
|
|
56
|
+
- **TIFF**: Multiple compression algorithms (none, LZW, ZIP)
|
|
57
|
+
- **PPM**: Raw uncompressed format for processing pipelines
|
|
58
|
+
|
|
59
|
+
- **Performance Optimizations**
|
|
60
|
+
- Parallel buffer creation support
|
|
61
|
+
- Memory caching of processed images
|
|
62
|
+
- Efficient Sharp.js integration
|
|
63
|
+
- Optimized memory management and cleanup
|
|
64
|
+
|
|
65
|
+
#### ๐งช Comprehensive Buffer Testing Framework
|
|
66
|
+
|
|
67
|
+
- **Complete Test Suite** (`test/buffer-creation.test.js`)
|
|
68
|
+
|
|
69
|
+
- Detailed testing of all 7 buffer creation methods
|
|
70
|
+
- Quality, compression, and resize parameter validation
|
|
71
|
+
- Performance benchmarking and parallel creation tests
|
|
72
|
+
- Format-specific option testing and edge case handling
|
|
73
|
+
|
|
74
|
+
- **Quick Verification** (`test/quick-buffer-verification.js`)
|
|
75
|
+
|
|
76
|
+
- Fast smoke test for basic functionality
|
|
77
|
+
- Tests JPEG, PNG, WebP, and Thumbnail creation
|
|
78
|
+
- Runtime: ~2-3 seconds with output file generation
|
|
79
|
+
|
|
80
|
+
- **Edge Case Testing** (`test/buffer-edge-cases.test.js`)
|
|
81
|
+
|
|
82
|
+
- Memory management stress testing
|
|
83
|
+
- Extreme parameter validation
|
|
84
|
+
- Multiple processor instances
|
|
85
|
+
- Format magic byte validation
|
|
86
|
+
|
|
87
|
+
- **Integration Tests** (`test/buffer-integration.test.js`)
|
|
88
|
+
|
|
89
|
+
- Mocha/Chai framework compatibility
|
|
90
|
+
- Proper error handling validation
|
|
91
|
+
- Parameter boundary testing
|
|
92
|
+
- Cross-method consistency checks
|
|
93
|
+
|
|
94
|
+
- **Unified Test Runner** (`test/run-buffer-tests.js`)
|
|
95
|
+
- Colored console output with progress tracking
|
|
96
|
+
- Flexible command-line options (--quick-only, --comprehensive-only, etc.)
|
|
97
|
+
- Environment checking and validation
|
|
98
|
+
- Performance reporting and statistics
|
|
99
|
+
|
|
100
|
+
#### ๐ Real-World Performance Validation
|
|
101
|
+
|
|
102
|
+
- **Buffer Creation Benchmarks** (Canon CR3 test files):
|
|
103
|
+
|
|
104
|
+
- **JPEG Buffer**: 34.7KB, 600x400 (255ms) - Excellent compression
|
|
105
|
+
- **PNG Buffer**: 97.5KB, 500x333 (403ms) - Lossless quality
|
|
106
|
+
- **WebP Buffer**: 15.9KB, 600x400 (87ms) - Superior compression/speed
|
|
107
|
+
- **AVIF Buffer**: 7.5KB, 500x333 (360ms) - Next-gen compression
|
|
108
|
+
- **TIFF Buffer**: 186.1KB, 400x267 (52ms) - Professional quality
|
|
109
|
+
- **Thumbnail Buffer**: 8.5KB, 200x133 (76ms) - Fast extraction
|
|
110
|
+
|
|
111
|
+
- **Parallel Creation Performance**
|
|
112
|
+
- 3 formats created simultaneously in 274ms
|
|
113
|
+
- No memory interference between buffer operations
|
|
114
|
+
- Consistent quality across parallel generations
|
|
115
|
+
|
|
116
|
+
#### ๐ ๏ธ Developer Tools & Documentation
|
|
117
|
+
|
|
118
|
+
- **Buffer Method Documentation**
|
|
119
|
+
|
|
120
|
+
- Complete TypeScript definitions in `lib/index.d.ts`
|
|
121
|
+
- Interface definitions for all result objects
|
|
122
|
+
- Parameter type validation and descriptions
|
|
123
|
+
|
|
124
|
+
- **Usage Examples and Demos**
|
|
125
|
+
|
|
126
|
+
- `test/buffer-demo.js` - Working demonstration of all methods
|
|
127
|
+
- `test/final-buffer-test.js` - Comprehensive validation script
|
|
128
|
+
- API usage examples for web applications and streaming workflows
|
|
129
|
+
|
|
130
|
+
- **NPM Scripts Integration**
|
|
131
|
+
- `npm run test:buffer-creation` - Run comprehensive buffer tests
|
|
132
|
+
- Integration with existing test framework
|
|
133
|
+
- Command-line test runners with flexible options
|
|
134
|
+
|
|
135
|
+
### ๐ง Technical Implementation
|
|
136
|
+
|
|
137
|
+
#### ๐ฆ Enhanced Dependencies Integration
|
|
138
|
+
|
|
139
|
+
- **Sharp 0.33.5** Integration
|
|
140
|
+
|
|
141
|
+
- High-performance image processing for buffer creation
|
|
142
|
+
- Native C++ implementation for maximum speed
|
|
143
|
+
- Memory-efficient processing for large images
|
|
144
|
+
- Cross-platform compatibility (Windows, macOS, Linux)
|
|
145
|
+
|
|
146
|
+
- **Seamless LibRaw Integration**
|
|
147
|
+
- Direct memory transfer between LibRaw and Sharp
|
|
148
|
+
- Automatic bit depth detection and conversion
|
|
149
|
+
- Color space preservation and transformation
|
|
150
|
+
- Smart processing pipeline with caching
|
|
151
|
+
|
|
152
|
+
#### โก Performance Characteristics
|
|
153
|
+
|
|
154
|
+
- **Processing Speed**: 70-140 MB/s for image processing
|
|
155
|
+
- **Buffer Creation**: 50-800ms depending on format and size
|
|
156
|
+
- **Memory Efficiency**: Streaming processing with automatic cleanup
|
|
157
|
+
- **Compression Ratios**: 6x to 500x depending on format and content
|
|
158
|
+
|
|
159
|
+
#### ๐ฏ Quality Optimization
|
|
160
|
+
|
|
161
|
+
- **Color Accuracy**
|
|
162
|
+
|
|
163
|
+
- Proper color space handling from RAW to final format
|
|
164
|
+
- White balance and gamma correction preservation
|
|
165
|
+
- Color matrix transformation support
|
|
166
|
+
|
|
167
|
+
- **Detail Preservation**
|
|
168
|
+
- High-quality resampling algorithms
|
|
169
|
+
- Edge-preserving compression
|
|
170
|
+
- Format-appropriate optimization
|
|
171
|
+
|
|
172
|
+
### ๐ง API Enhancements
|
|
173
|
+
|
|
174
|
+
#### New TypeScript Definitions
|
|
175
|
+
|
|
176
|
+
```typescript
|
|
177
|
+
interface LibRawBufferResult {
|
|
178
|
+
success: boolean;
|
|
179
|
+
buffer: Buffer;
|
|
180
|
+
metadata: {
|
|
181
|
+
format: string;
|
|
182
|
+
outputDimensions: { width: number; height: number };
|
|
183
|
+
fileSize: {
|
|
184
|
+
original: number;
|
|
185
|
+
compressed: number;
|
|
186
|
+
compressionRatio: string;
|
|
187
|
+
};
|
|
188
|
+
processing: {
|
|
189
|
+
timeMs: string;
|
|
190
|
+
throughputMBps: string;
|
|
191
|
+
};
|
|
192
|
+
options: object;
|
|
193
|
+
};
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
// Method signatures for all buffer creation methods
|
|
197
|
+
async createJPEGBuffer(options?: JpegOptions): Promise<LibRawBufferResult>;
|
|
198
|
+
async createPNGBuffer(options?: PngOptions): Promise<LibRawBufferResult>;
|
|
199
|
+
async createWebPBuffer(options?: WebpOptions): Promise<LibRawBufferResult>;
|
|
200
|
+
async createAVIFBuffer(options?: AvifOptions): Promise<LibRawBufferResult>;
|
|
201
|
+
async createTIFFBuffer(options?: TiffOptions): Promise<LibRawBufferResult>;
|
|
202
|
+
async createPPMBuffer(): Promise<LibRawBufferResult>;
|
|
203
|
+
async createThumbnailJPEGBuffer(options?: ThumbnailOptions): Promise<LibRawBufferResult>;
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
#### Consistent Option Interfaces
|
|
207
|
+
|
|
208
|
+
- **Quality Settings**: 1-100 range for lossy formats
|
|
209
|
+
- **Resize Options**: Width/height with automatic aspect ratio
|
|
210
|
+
- **Compression Control**: Format-specific compression parameters
|
|
211
|
+
- **Speed Optimization**: Fast mode options for time-critical applications
|
|
212
|
+
|
|
213
|
+
### ๐ Usage Examples
|
|
214
|
+
|
|
215
|
+
#### Basic Buffer Creation
|
|
216
|
+
|
|
217
|
+
```javascript
|
|
218
|
+
const processor = new LibRaw();
|
|
219
|
+
await processor.loadFile("photo.cr2");
|
|
220
|
+
await processor.processImage();
|
|
221
|
+
|
|
222
|
+
// Create different format buffers
|
|
223
|
+
const jpegResult = await processor.createJPEGBuffer({
|
|
224
|
+
quality: 85,
|
|
225
|
+
width: 1200,
|
|
226
|
+
});
|
|
227
|
+
const webpResult = await processor.createWebPBuffer({
|
|
228
|
+
quality: 80,
|
|
229
|
+
width: 1200,
|
|
230
|
+
});
|
|
231
|
+
|
|
232
|
+
// Use buffers directly - no file I/O needed!
|
|
233
|
+
response.setHeader("Content-Type", "image/jpeg");
|
|
234
|
+
response.send(jpegResult.buffer);
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
#### Parallel Multi-Format Creation
|
|
238
|
+
|
|
239
|
+
```javascript
|
|
240
|
+
// Generate multiple formats simultaneously
|
|
241
|
+
const [jpeg, png, webp, thumb] = await Promise.all([
|
|
242
|
+
processor.createJPEGBuffer({ quality: 85, width: 1920 }),
|
|
243
|
+
processor.createPNGBuffer({ width: 1200, compressionLevel: 6 }),
|
|
244
|
+
processor.createWebPBuffer({ quality: 80, width: 1920 }),
|
|
245
|
+
processor.createThumbnailJPEGBuffer({ maxSize: 300 }),
|
|
246
|
+
]);
|
|
247
|
+
|
|
248
|
+
console.log(
|
|
249
|
+
`Created 4 formats in parallel: ${
|
|
250
|
+
jpeg.buffer.length +
|
|
251
|
+
png.buffer.length +
|
|
252
|
+
webp.buffer.length +
|
|
253
|
+
thumb.buffer.length
|
|
254
|
+
} total bytes`
|
|
255
|
+
);
|
|
256
|
+
```
|
|
257
|
+
|
|
258
|
+
#### Web API Integration
|
|
259
|
+
|
|
260
|
+
```javascript
|
|
261
|
+
// Express.js API endpoint
|
|
262
|
+
app.get("/api/photo/:id/formats", async (req, res) => {
|
|
263
|
+
const processor = new LibRaw();
|
|
264
|
+
try {
|
|
265
|
+
await processor.loadFile(`photos/${req.params.id}.cr2`);
|
|
266
|
+
await processor.processImage();
|
|
267
|
+
|
|
268
|
+
const formats = await Promise.all([
|
|
269
|
+
processor.createJPEGBuffer({ quality: 85, width: 1920 }),
|
|
270
|
+
processor.createWebPBuffer({ quality: 80, width: 1920 }),
|
|
271
|
+
processor.createThumbnailJPEGBuffer({ maxSize: 300 }),
|
|
272
|
+
]);
|
|
273
|
+
|
|
274
|
+
res.json({
|
|
275
|
+
jpeg: formats[0].buffer.toString("base64"),
|
|
276
|
+
webp: formats[1].buffer.toString("base64"),
|
|
277
|
+
thumbnail: formats[2].buffer.toString("base64"),
|
|
278
|
+
});
|
|
279
|
+
} finally {
|
|
280
|
+
await processor.close();
|
|
281
|
+
}
|
|
282
|
+
});
|
|
283
|
+
```
|
|
284
|
+
|
|
285
|
+
### ๐งช Testing & Validation
|
|
286
|
+
|
|
287
|
+
#### Comprehensive Test Coverage
|
|
288
|
+
|
|
289
|
+
- **Format Validation**: Magic byte verification for all formats
|
|
290
|
+
- **Quality Testing**: Multiple quality levels and compression settings
|
|
291
|
+
- **Resize Testing**: Various dimension scenarios with aspect ratio preservation
|
|
292
|
+
- **Performance Testing**: Speed and throughput measurement
|
|
293
|
+
- **Memory Testing**: Leak detection and cleanup verification
|
|
294
|
+
- **Error Handling**: Invalid parameter and edge case testing
|
|
295
|
+
|
|
296
|
+
#### Real-World File Validation
|
|
297
|
+
|
|
298
|
+
- **Camera Compatibility**: Tested with Canon CR3, Nikon NEF, Sony ARW files
|
|
299
|
+
- **File Size Range**: 20MB - 100MB RAW files processed successfully
|
|
300
|
+
- **Resolution Range**: 12MP - 61MP images handled efficiently
|
|
301
|
+
- **Success Rate**: 100% success rate for buffer creation across all test files
|
|
302
|
+
|
|
303
|
+
### ๐ง Testing Commands
|
|
304
|
+
|
|
305
|
+
#### Quick Testing
|
|
306
|
+
|
|
307
|
+
```bash
|
|
308
|
+
# Fast verification of all buffer methods
|
|
309
|
+
node test/quick-buffer-verification.js
|
|
310
|
+
|
|
311
|
+
# Run comprehensive buffer test suite
|
|
312
|
+
node test/run-buffer-tests.js
|
|
313
|
+
|
|
314
|
+
# Quick-only test
|
|
315
|
+
node test/run-buffer-tests.js --quick-only
|
|
316
|
+
```
|
|
317
|
+
|
|
318
|
+
#### Integration Testing
|
|
319
|
+
|
|
320
|
+
```bash
|
|
321
|
+
# Add buffer tests to existing test suite
|
|
322
|
+
npm run test:buffer-creation
|
|
323
|
+
|
|
324
|
+
# Run with other tests
|
|
325
|
+
npm test
|
|
326
|
+
```
|
|
327
|
+
|
|
328
|
+
#### Performance Testing
|
|
329
|
+
|
|
330
|
+
```bash
|
|
331
|
+
# Benchmark all buffer creation methods
|
|
332
|
+
node test/run-buffer-tests.js --comprehensive-only
|
|
333
|
+
|
|
334
|
+
# Test edge cases and memory management
|
|
335
|
+
node test/run-buffer-tests.js --edge-only
|
|
336
|
+
```
|
|
337
|
+
|
|
338
|
+
### ๐ Stream-Based Processing Benefits
|
|
339
|
+
|
|
340
|
+
This release directly addresses the core requirement for stream-based processing:
|
|
341
|
+
|
|
342
|
+
#### Before (File-Based)
|
|
343
|
+
|
|
344
|
+
```javascript
|
|
345
|
+
// Required intermediate files
|
|
346
|
+
await processor.writeTIFF("temp.tiff");
|
|
347
|
+
const buffer = fs.readFileSync("temp.tiff");
|
|
348
|
+
fs.unlinkSync("temp.tiff"); // Cleanup required
|
|
349
|
+
```
|
|
350
|
+
|
|
351
|
+
#### After (Buffer-Based)
|
|
352
|
+
|
|
353
|
+
```javascript
|
|
354
|
+
// Direct buffer creation - no files needed
|
|
355
|
+
const result = await processor.createTIFFBuffer({ compression: "lzw" });
|
|
356
|
+
const buffer = result.buffer; // Ready to use immediately
|
|
357
|
+
```
|
|
358
|
+
|
|
359
|
+
#### Performance Improvements
|
|
360
|
+
|
|
361
|
+
- **50-80% Faster**: No disk I/O overhead
|
|
362
|
+
- **Better Memory Usage**: No temporary file storage
|
|
363
|
+
- **Cleaner Code**: No file cleanup required
|
|
364
|
+
- **More Reliable**: No file system permission issues
|
|
365
|
+
|
|
366
|
+
### ๐ Fixed
|
|
367
|
+
|
|
368
|
+
#### Memory Management Improvements
|
|
369
|
+
|
|
370
|
+
- **Buffer Cleanup**: Automatic cleanup of intermediate buffers
|
|
371
|
+
- **Memory Leak Prevention**: Proper resource management in all code paths
|
|
372
|
+
- **Error Recovery**: Graceful handling of processing failures
|
|
373
|
+
- **Resource Optimization**: Efficient memory allocation patterns
|
|
374
|
+
|
|
375
|
+
#### Format Compatibility Enhancements
|
|
376
|
+
|
|
377
|
+
- **Magic Byte Validation**: Proper format header generation
|
|
378
|
+
- **Color Space Handling**: Accurate color space preservation
|
|
379
|
+
- **Dimension Calculation**: Correct aspect ratio maintenance
|
|
380
|
+
- **Quality Consistency**: Consistent quality across multiple creations
|
|
381
|
+
|
|
382
|
+
### ๐ Performance Impact
|
|
383
|
+
|
|
384
|
+
#### Speed Improvements
|
|
385
|
+
|
|
386
|
+
- **Direct Buffer Creation**: Eliminates file I/O bottlenecks
|
|
387
|
+
- **Parallel Processing**: Multiple formats created simultaneously
|
|
388
|
+
- **Memory Efficiency**: Reduced memory footprint through smart caching
|
|
389
|
+
- **Processing Pipeline**: Optimized workflow with shared processed data
|
|
390
|
+
|
|
391
|
+
#### Quality Enhancements
|
|
392
|
+
|
|
393
|
+
- **Better Compression**: Format-specific optimization for each output type
|
|
394
|
+
- **Color Accuracy**: Improved color space handling and preservation
|
|
395
|
+
- **Detail Preservation**: High-quality resampling and compression
|
|
396
|
+
- **Consistency**: Identical results across multiple buffer creations
|
|
397
|
+
|
|
398
|
+
### ๐ฎ Future Enhancements
|
|
399
|
+
|
|
400
|
+
#### Planned Buffer Features
|
|
401
|
+
|
|
402
|
+
- **Advanced Options**: HDR processing, color grading, noise reduction
|
|
403
|
+
- **Additional Formats**: HEIF, BMP, TGA support
|
|
404
|
+
- **Streaming Support**: Large file processing with stream interfaces
|
|
405
|
+
- **GPU Acceleration**: Hardware-accelerated buffer creation
|
|
406
|
+
|
|
407
|
+
#### API Extensions
|
|
408
|
+
|
|
409
|
+
- **Metadata Preservation**: EXIF data embedding in output buffers
|
|
410
|
+
- **Batch Buffer Creation**: Process multiple files to buffers
|
|
411
|
+
- **Progressive Processing**: Real-time buffer updates during processing
|
|
412
|
+
- **Custom Pipelines**: User-defined processing chains
|
|
413
|
+
|
|
414
|
+
---
|
|
415
|
+
|
|
416
|
+
## [1.0.0-alpha.2] - 2025-08-24
|
|
417
|
+
|
|
418
|
+
### ๐ Major Feature Release - RAW to JPEG Conversion
|
|
419
|
+
|
|
420
|
+
This release introduces a complete RAW to JPEG conversion system with advanced optimization options, batch processing capabilities, and intelligent settings analysis.
|
|
421
|
+
|
|
422
|
+
### โจ Added
|
|
423
|
+
|
|
424
|
+
#### ๐ผ๏ธ High-Performance JPEG Conversion Engine
|
|
425
|
+
|
|
426
|
+
- **Advanced JPEG Conversion** (`convertToJPEG()`)
|
|
427
|
+
|
|
428
|
+
- High-quality RAW to JPEG conversion using Sharp library
|
|
429
|
+
- Support for quality levels 1-100 with optimal compression
|
|
430
|
+
- Multiple color spaces: sRGB, Rec2020, P3, CMYK
|
|
431
|
+
- Advanced chroma subsampling options (4:4:4, 4:2:2, 4:2:0)
|
|
432
|
+
- Progressive JPEG support for web optimization
|
|
433
|
+
- MozJPEG encoder integration for superior compression
|
|
434
|
+
|
|
435
|
+
- **Intelligent Resizing & Scaling**
|
|
436
|
+
|
|
437
|
+
- Maintain aspect ratio with single dimension specification
|
|
438
|
+
- High-quality Lanczos3 resampling for crisp results
|
|
439
|
+
- Optimized for both enlargement and reduction
|
|
440
|
+
- Automatic image dimension analysis
|
|
441
|
+
|
|
442
|
+
- **Compression Optimization Features**
|
|
443
|
+
- Trellis quantisation for better compression efficiency
|
|
444
|
+
- Huffman coding optimization
|
|
445
|
+
- Scan order optimization for progressive loading
|
|
446
|
+
- Overshoot deringing for artifact reduction
|
|
447
|
+
- Customizable quality curves and gamma correction
|
|
448
|
+
|
|
449
|
+
#### ๐ Batch Processing System
|
|
450
|
+
|
|
451
|
+
- **Batch Conversion** (`batchConvertToJPEG()`)
|
|
452
|
+
|
|
453
|
+
- Process hundreds of RAW files in a single operation
|
|
454
|
+
- Parallel processing for maximum throughput
|
|
455
|
+
- Comprehensive error handling and recovery
|
|
456
|
+
- Detailed progress reporting and statistics
|
|
457
|
+
- Automatic output directory management
|
|
458
|
+
|
|
459
|
+
- **Conversion Presets**
|
|
460
|
+
- **Web Optimized**: 1920px, Q80, Progressive, MozJPEG
|
|
461
|
+
- **Print Quality**: Original size, Q95, 4:2:2 chroma
|
|
462
|
+
- **Archive**: Original size, Q98, 4:4:4 chroma, maximum quality
|
|
463
|
+
- **Thumbnails**: 800px, Q85, optimized for small sizes
|
|
464
|
+
|
|
465
|
+
#### ๐ง AI-Powered Settings Analysis
|
|
466
|
+
|
|
467
|
+
- **Optimal Settings Recommendation** (`getOptimalJPEGSettings()`)
|
|
468
|
+
|
|
469
|
+
- Automatic image analysis for optimal quality/size balance
|
|
470
|
+
- Usage-specific optimization (web, print, archive)
|
|
471
|
+
- Camera-specific settings based on manufacturer
|
|
472
|
+
- Resolution-based quality adjustment
|
|
473
|
+
- Intelligent chroma subsampling selection
|
|
474
|
+
|
|
475
|
+
- **Image Analysis Engine**
|
|
476
|
+
- Megapixel categorization (high/medium/low resolution)
|
|
477
|
+
- Camera metadata integration for optimal settings
|
|
478
|
+
- Color space analysis and recommendations
|
|
479
|
+
- Quality vs file size optimization
|
|
480
|
+
|
|
481
|
+
#### ๐ Performance & Monitoring
|
|
482
|
+
|
|
483
|
+
- **Real-time Performance Metrics**
|
|
484
|
+
|
|
485
|
+
- Processing time measurement (sub-millisecond precision)
|
|
486
|
+
- Throughput calculation (MB/s, MP/s)
|
|
487
|
+
- Compression ratio analysis
|
|
488
|
+
- File size before/after comparison
|
|
489
|
+
- Memory usage optimization
|
|
490
|
+
|
|
491
|
+
- **Comprehensive Reporting**
|
|
492
|
+
- HTML report generation with visual analytics
|
|
493
|
+
- Success/failure rate tracking
|
|
494
|
+
- Processing time distribution analysis
|
|
495
|
+
- Space savings calculation
|
|
496
|
+
- Performance benchmarking
|
|
497
|
+
|
|
498
|
+
#### ๐ ๏ธ Developer Tools & Scripts
|
|
499
|
+
|
|
500
|
+
- **Batch Conversion Script** (`scripts/batch-jpeg-conversion.js`)
|
|
501
|
+
|
|
502
|
+
- Command-line interface for batch processing
|
|
503
|
+
- Interactive preset selection
|
|
504
|
+
- HTML report generation
|
|
505
|
+
- Progress monitoring and error reporting
|
|
506
|
+
|
|
507
|
+
- **JPEG Conversion Examples** (`examples/jpeg-conversion-example.js`)
|
|
508
|
+
|
|
509
|
+
- Complete usage demonstrations
|
|
510
|
+
- Quality comparison examples
|
|
511
|
+
- Resize and optimization samples
|
|
512
|
+
- Best practices guidance
|
|
513
|
+
|
|
514
|
+
- **Comprehensive Test Suite** (`test/jpeg-conversion.test.js`)
|
|
515
|
+
- Quality level validation (60-95% range)
|
|
516
|
+
- Resize option testing
|
|
517
|
+
- Batch processing validation
|
|
518
|
+
- Optimization feature testing
|
|
519
|
+
- Performance benchmarking
|
|
520
|
+
|
|
521
|
+
### ๐ง Technical Implementation
|
|
522
|
+
|
|
523
|
+
#### ๐ฆ Dependencies & Integration
|
|
524
|
+
|
|
525
|
+
- **Sharp 0.33.0** - High-performance image processing
|
|
526
|
+
|
|
527
|
+
- Native C++ implementation for maximum speed
|
|
528
|
+
- Advanced JPEG encoding with MozJPEG support
|
|
529
|
+
- Memory-efficient processing for large images
|
|
530
|
+
- Cross-platform compatibility (Windows, macOS, Linux)
|
|
531
|
+
|
|
532
|
+
- **Enhanced LibRaw Integration**
|
|
533
|
+
- Seamless integration with existing RAW processing pipeline
|
|
534
|
+
- Memory-efficient data transfer between LibRaw and Sharp
|
|
535
|
+
- Automatic bit depth detection and conversion
|
|
536
|
+
- Color space preservation and transformation
|
|
537
|
+
|
|
538
|
+
#### โก Performance Characteristics
|
|
539
|
+
|
|
540
|
+
- **Processing Speed**: 70-140 MB/s throughput on modern hardware
|
|
541
|
+
- **Memory Efficiency**: Streaming processing for large files
|
|
542
|
+
- **Compression Performance**: 2-10x compression ratios typical
|
|
543
|
+
- **Quality Preservation**: Visually lossless at Q85+ settings
|
|
544
|
+
|
|
545
|
+
#### ๐ฏ Quality Optimization
|
|
546
|
+
|
|
547
|
+
- **Color Accuracy**
|
|
548
|
+
|
|
549
|
+
- Proper color space handling from RAW to JPEG
|
|
550
|
+
- White balance preservation
|
|
551
|
+
- Gamma correction maintenance
|
|
552
|
+
- Color matrix transformation support
|
|
553
|
+
|
|
554
|
+
- **Detail Preservation**
|
|
555
|
+
- High-quality resampling algorithms
|
|
556
|
+
- Edge-preserving compression
|
|
557
|
+
- Noise reduction integration
|
|
558
|
+
- Sharpening optimization
|
|
559
|
+
|
|
560
|
+
### ๐ง API Enhancements
|
|
561
|
+
|
|
562
|
+
#### New TypeScript Definitions
|
|
563
|
+
|
|
564
|
+
```typescript
|
|
565
|
+
interface LibRawJPEGOptions {
|
|
566
|
+
quality?: number; // 1-100 JPEG quality
|
|
567
|
+
width?: number; // Target width
|
|
568
|
+
height?: number; // Target height
|
|
569
|
+
progressive?: boolean; // Progressive JPEG
|
|
570
|
+
mozjpeg?: boolean; // Use MozJPEG encoder
|
|
571
|
+
chromaSubsampling?: "4:4:4" | "4:2:2" | "4:2:0";
|
|
572
|
+
trellisQuantisation?: boolean; // Advanced compression
|
|
573
|
+
optimizeScans?: boolean; // Scan optimization
|
|
574
|
+
overshootDeringing?: boolean; // Artifact reduction
|
|
575
|
+
optimizeCoding?: boolean; // Huffman optimization
|
|
576
|
+
colorSpace?: "srgb" | "rec2020" | "p3" | "cmyk";
|
|
577
|
+
}
|
|
578
|
+
|
|
579
|
+
interface LibRawJPEGResult {
|
|
580
|
+
success: boolean;
|
|
581
|
+
outputPath: string;
|
|
582
|
+
metadata: {
|
|
583
|
+
originalDimensions: { width: number; height: number };
|
|
584
|
+
outputDimensions: { width: number; height: number };
|
|
585
|
+
fileSize: {
|
|
586
|
+
original: number;
|
|
587
|
+
compressed: number;
|
|
588
|
+
compressionRatio: string;
|
|
589
|
+
};
|
|
590
|
+
processing: { timeMs: string; throughputMBps: string };
|
|
591
|
+
jpegOptions: object;
|
|
592
|
+
};
|
|
593
|
+
}
|
|
594
|
+
```
|
|
595
|
+
|
|
596
|
+
#### Enhanced Method Signatures
|
|
597
|
+
|
|
598
|
+
```javascript
|
|
599
|
+
// Basic JPEG conversion
|
|
600
|
+
await processor.convertToJPEG(outputPath, options);
|
|
601
|
+
|
|
602
|
+
// Batch processing
|
|
603
|
+
await processor.batchConvertToJPEG(inputPaths, outputDir, options);
|
|
604
|
+
|
|
605
|
+
// Intelligent settings analysis
|
|
606
|
+
await processor.getOptimalJPEGSettings({ usage: "web" });
|
|
607
|
+
```
|
|
608
|
+
|
|
609
|
+
### ๐ Usage Examples
|
|
610
|
+
|
|
611
|
+
#### Basic JPEG Conversion
|
|
612
|
+
|
|
613
|
+
```javascript
|
|
614
|
+
const processor = new LibRaw();
|
|
615
|
+
await processor.loadFile("photo.cr2");
|
|
616
|
+
|
|
617
|
+
// High-quality conversion
|
|
618
|
+
const result = await processor.convertToJPEG("output.jpg", {
|
|
619
|
+
quality: 90,
|
|
620
|
+
progressive: true,
|
|
621
|
+
mozjpeg: true,
|
|
622
|
+
});
|
|
623
|
+
|
|
624
|
+
console.log(`Saved: ${result.metadata.fileSize.compressed} bytes`);
|
|
625
|
+
console.log(`Compression: ${result.metadata.fileSize.compressionRatio}x`);
|
|
626
|
+
```
|
|
627
|
+
|
|
628
|
+
#### Web-Optimized Batch Processing
|
|
629
|
+
|
|
630
|
+
```javascript
|
|
631
|
+
const result = await processor.batchConvertToJPEG(
|
|
632
|
+
["photo1.cr2", "photo2.nef", "photo3.arw"],
|
|
633
|
+
"./web-gallery",
|
|
634
|
+
{
|
|
635
|
+
quality: 80,
|
|
636
|
+
width: 1920,
|
|
637
|
+
progressive: true,
|
|
638
|
+
mozjpeg: true,
|
|
639
|
+
}
|
|
640
|
+
);
|
|
641
|
+
|
|
642
|
+
console.log(`Processed: ${result.summary.processed}/${result.summary.total}`);
|
|
643
|
+
console.log(`Space saved: ${result.summary.totalSavedSpace}MB`);
|
|
644
|
+
```
|
|
645
|
+
|
|
646
|
+
#### AI-Optimized Settings
|
|
647
|
+
|
|
648
|
+
```javascript
|
|
649
|
+
// Analyze image and get recommendations
|
|
650
|
+
const analysis = await processor.getOptimalJPEGSettings({ usage: "web" });
|
|
651
|
+
|
|
652
|
+
// Apply recommended settings
|
|
653
|
+
await processor.convertToJPEG("optimized.jpg", analysis.recommended);
|
|
654
|
+
```
|
|
655
|
+
|
|
656
|
+
### ๐งช Testing & Validation
|
|
657
|
+
|
|
658
|
+
#### Comprehensive Test Coverage
|
|
659
|
+
|
|
660
|
+
- **Quality Validation**: 6 quality levels tested (60-95%)
|
|
661
|
+
- **Size Testing**: 5 resize scenarios validated
|
|
662
|
+
- **Batch Processing**: Multi-file conversion testing
|
|
663
|
+
- **Optimization Features**: 8 optimization combinations tested
|
|
664
|
+
- **Performance Benchmarking**: Speed and throughput measurement
|
|
665
|
+
|
|
666
|
+
#### Real-World Validation
|
|
667
|
+
|
|
668
|
+
- **Camera Compatibility**: Tested with Canon, Nikon, Sony, Fujifilm, Panasonic, Leica
|
|
669
|
+
- **File Size Range**: 20MB - 100MB RAW files
|
|
670
|
+
- **Resolution Range**: 12MP - 61MP images
|
|
671
|
+
- **Format Coverage**: CR2, CR3, NEF, ARW, RAF, RW2, DNG
|
|
672
|
+
|
|
673
|
+
#### Performance Benchmarks
|
|
674
|
+
|
|
675
|
+
| Resolution | Quality | Processing Time | Throughput | Compression |
|
|
676
|
+
| ---------- | ------- | --------------- | ---------- | ----------- |
|
|
677
|
+
| 24MP | 80% | 1.2s | 85 MB/s | 8.5x |
|
|
678
|
+
| 42MP | 85% | 2.1s | 95 MB/s | 7.2x |
|
|
679
|
+
| 61MP | 90% | 3.2s | 110 MB/s | 6.1x |
|
|
680
|
+
|
|
681
|
+
### ๐ง Scripts & Tools
|
|
682
|
+
|
|
683
|
+
#### NPM Scripts
|
|
684
|
+
|
|
685
|
+
```bash
|
|
686
|
+
# Run JPEG conversion tests
|
|
687
|
+
npm run test:jpeg-conversion
|
|
688
|
+
|
|
689
|
+
# Batch convert RAW files
|
|
690
|
+
npm run convert:jpeg <input-dir> [output-dir] [preset]
|
|
691
|
+
|
|
692
|
+
# Example: Web-optimized conversion
|
|
693
|
+
npm run convert:jpeg ./raw-photos ./web-gallery 1
|
|
694
|
+
```
|
|
695
|
+
|
|
696
|
+
#### Command Line Tools
|
|
697
|
+
|
|
698
|
+
```bash
|
|
699
|
+
# Basic conversion example
|
|
700
|
+
node examples/jpeg-conversion-example.js photo.cr2
|
|
701
|
+
|
|
702
|
+
# Batch conversion with presets
|
|
703
|
+
node scripts/batch-jpeg-conversion.js ./photos ./output 2
|
|
704
|
+
```
|
|
705
|
+
|
|
706
|
+
### ๐ Performance Optimizations
|
|
707
|
+
|
|
708
|
+
#### Memory Management
|
|
709
|
+
|
|
710
|
+
- **Streaming Processing**: Large files processed in chunks
|
|
711
|
+
- **Buffer Reuse**: Efficient memory allocation patterns
|
|
712
|
+
- **Garbage Collection**: Automatic cleanup of intermediate buffers
|
|
713
|
+
- **Memory Monitoring**: Real-time memory usage tracking
|
|
714
|
+
|
|
715
|
+
#### Processing Pipeline
|
|
716
|
+
|
|
717
|
+
- **Parallel Processing**: Multiple files processed concurrently
|
|
718
|
+
- **CPU Optimization**: Multi-core utilization for encoding
|
|
719
|
+
- **I/O Optimization**: Asynchronous file operations
|
|
720
|
+
- **Cache Efficiency**: Optimal data locality patterns
|
|
721
|
+
|
|
722
|
+
### ๐ Fixed
|
|
723
|
+
|
|
724
|
+
#### Stability Improvements
|
|
725
|
+
|
|
726
|
+
- **Memory Leak Prevention**: Proper buffer cleanup in all code paths
|
|
727
|
+
- **Error Recovery**: Graceful handling of corrupted or unusual files
|
|
728
|
+
- **Resource Management**: Automatic cleanup on process termination
|
|
729
|
+
- **Thread Safety**: Safe concurrent access to LibRaw instances
|
|
730
|
+
|
|
731
|
+
#### Compatibility Enhancements
|
|
732
|
+
|
|
733
|
+
- **Windows Platform**: Optimized file path handling and directory creation
|
|
734
|
+
- **Large File Support**: Improved handling of >100MB RAW files
|
|
735
|
+
- **Edge Cases**: Better support for unusual camera formats
|
|
736
|
+
- **Color Space Handling**: Proper ICC profile management
|
|
737
|
+
|
|
738
|
+
### ๐ Performance Impact
|
|
739
|
+
|
|
740
|
+
#### Speed Improvements
|
|
741
|
+
|
|
742
|
+
- **2x Faster**: JPEG conversion compared to external tools
|
|
743
|
+
- **3x More Efficient**: Memory usage optimization
|
|
744
|
+
- **50% Smaller**: Output file sizes with equivalent quality
|
|
745
|
+
- **10x Faster**: Batch processing compared to sequential conversion
|
|
746
|
+
|
|
747
|
+
#### Quality Enhancements
|
|
748
|
+
|
|
749
|
+
- **Better Compression**: MozJPEG encoder provides superior compression
|
|
750
|
+
- **Color Accuracy**: Improved color space handling
|
|
751
|
+
- **Detail Preservation**: Advanced resampling algorithms
|
|
752
|
+
- **Artifact Reduction**: Optimized quantization and deringing
|
|
753
|
+
|
|
754
|
+
### ๐ฎ Future Enhancements
|
|
755
|
+
|
|
756
|
+
#### Planned Features
|
|
757
|
+
|
|
758
|
+
- **WebP Conversion**: Modern format support
|
|
759
|
+
- **AVIF Support**: Next-generation compression
|
|
760
|
+
- **HDR Processing**: Enhanced dynamic range handling
|
|
761
|
+
- **GPU Acceleration**: CUDA/OpenCL support for faster processing
|
|
762
|
+
|
|
763
|
+
#### API Extensions
|
|
764
|
+
|
|
765
|
+
- **Metadata Preservation**: EXIF data transfer to JPEG
|
|
766
|
+
- **Watermarking**: Built-in watermark application
|
|
767
|
+
- **Color Grading**: Advanced color correction tools
|
|
768
|
+
- **Noise Reduction**: AI-powered denoising
|
|
769
|
+
|
|
770
|
+
---
|
|
771
|
+
|
|
772
|
+
## [0.1.34-poc] - 2025-08-23
|
|
773
|
+
|
|
774
|
+
### ๐ Major Release - Production-Ready LibRaw Wrapper
|
|
775
|
+
|
|
776
|
+
This release represents a complete, production-ready implementation of the LibRaw library for Node.js with comprehensive testing and full API coverage.
|
|
777
|
+
|
|
778
|
+
### โจ Added
|
|
779
|
+
|
|
780
|
+
#### ๐ง Complete LibRaw API Implementation (50+ Methods)
|
|
781
|
+
|
|
782
|
+
- **Core Operations (10 methods)**
|
|
783
|
+
|
|
784
|
+
- `loadFile()` - Load RAW files from filesystem
|
|
785
|
+
- `loadBuffer()` - Load RAW data from memory buffer
|
|
786
|
+
- `close()` - Cleanup and resource management
|
|
787
|
+
- `raw2Image()` - Convert RAW data to processable image
|
|
788
|
+
- `processImage()` - Apply processing pipeline
|
|
789
|
+
- `subtractBlack()` - Black level subtraction
|
|
790
|
+
- `adjustMaximum()` - Adjust maximum values
|
|
791
|
+
- `unpack()` - Low-level RAW data unpacking
|
|
792
|
+
- `unpackThumbnail()` - Extract thumbnail data
|
|
793
|
+
- `freeImage()` - Free processed image memory
|
|
794
|
+
|
|
795
|
+
- **Metadata & Information (12 methods)**
|
|
796
|
+
|
|
797
|
+
- `getMetadata()` - Basic camera and image metadata
|
|
798
|
+
- `getImageSize()` - Detailed dimension information
|
|
799
|
+
- `getFileInfo()` - File-specific information
|
|
800
|
+
- `getAdvancedMetadata()` - Extended metadata with color info
|
|
801
|
+
- `getLensInfo()` - Lens information and specifications
|
|
802
|
+
- `getColorInfo()` - Color space and calibration data
|
|
803
|
+
- `getCameraColorMatrix()` - Camera color transformation matrix
|
|
804
|
+
- `getRGBCameraMatrix()` - RGB color transformation matrix
|
|
805
|
+
- `getDecoderInfo()` - RAW decoder information
|
|
806
|
+
- `checkLoaded()` - Verify file load status
|
|
807
|
+
- `getLastError()` - Error message retrieval
|
|
808
|
+
- `errorCount()` - Processing error count
|
|
809
|
+
|
|
810
|
+
- **Image Processing (8 methods)**
|
|
811
|
+
|
|
812
|
+
- `createMemoryImage()` - Generate processed image in memory
|
|
813
|
+
- `createMemoryThumbnail()` - Generate thumbnail in memory
|
|
814
|
+
- `getMemImageFormat()` - Memory image format information
|
|
815
|
+
- `copyMemImage()` - Copy image data to buffer
|
|
816
|
+
- `adjustSizesInfoOnly()` - Size adjustment without processing
|
|
817
|
+
- `raw2ImageEx()` - Extended RAW to image conversion
|
|
818
|
+
- `convertFloatToInt()` - Floating point conversion
|
|
819
|
+
- `getMemoryRequirements()` - Memory usage estimation
|
|
820
|
+
|
|
821
|
+
- **File Writers (6 methods)**
|
|
822
|
+
|
|
823
|
+
- `writePPM()` - Export to PPM format
|
|
824
|
+
- `writeTIFF()` - Export to TIFF format
|
|
825
|
+
- `writeThumbnail()` - Export thumbnail to JPEG
|
|
826
|
+
- Format validation and quality control
|
|
827
|
+
- Automatic directory creation
|
|
828
|
+
- Error handling for write operations
|
|
829
|
+
|
|
830
|
+
- **Configuration (4 methods)**
|
|
831
|
+
|
|
832
|
+
- `setOutputParams()` - Configure processing parameters
|
|
833
|
+
- `getOutputParams()` - Retrieve current parameters
|
|
834
|
+
- Color space selection (Raw, sRGB, Adobe RGB, Wide Gamut, ProPhoto, XYZ)
|
|
835
|
+
- Bit depth control (8-bit, 16-bit)
|
|
836
|
+
- Gamma correction and brightness adjustment
|
|
837
|
+
|
|
838
|
+
- **Extended Utilities (8 methods)**
|
|
839
|
+
|
|
840
|
+
- `isFloatingPoint()` - Check for floating point data
|
|
841
|
+
- `isFujiRotated()` - Detect Fuji sensor rotation
|
|
842
|
+
- `isSRAW()` - Detect sRAW format
|
|
843
|
+
- `isJPEGThumb()` - Check thumbnail format
|
|
844
|
+
- `isNikonSRAW()` - Nikon sRAW detection
|
|
845
|
+
- `isCoolscanNEF()` - Coolscan NEF detection
|
|
846
|
+
- `haveFPData()` - Floating point data availability
|
|
847
|
+
- `srawMidpoint()` - sRAW midpoint calculation
|
|
848
|
+
|
|
849
|
+
- **Color Operations (3 methods)**
|
|
850
|
+
|
|
851
|
+
- `getColorAt()` - Get color value at specific position
|
|
852
|
+
- `getWhiteBalance()` - White balance multipliers
|
|
853
|
+
- `setBayerPattern()` - Set color filter pattern
|
|
854
|
+
|
|
855
|
+
- **Static Methods (4 methods)**
|
|
856
|
+
- `LibRaw.getVersion()` - Library version information
|
|
857
|
+
- `LibRaw.getCapabilities()` - Library capabilities bitmask
|
|
858
|
+
- `LibRaw.getCameraList()` - Supported camera models list
|
|
859
|
+
- `LibRaw.getCameraCount()` - Number of supported cameras
|
|
860
|
+
|
|
861
|
+
#### ๐งช Comprehensive Testing Framework
|
|
862
|
+
|
|
863
|
+
- **Image Processing Test Suite** (`test/image-processing.test.js`)
|
|
864
|
+
|
|
865
|
+
- Thumbnail extraction validation (100% success rate)
|
|
866
|
+
- Image conversion workflow testing
|
|
867
|
+
- Advanced processing feature validation
|
|
868
|
+
- Parameter configuration testing
|
|
869
|
+
- Memory operations verification
|
|
870
|
+
|
|
871
|
+
- **Format Conversion Test Suite** (`test/format-conversion.test.js`)
|
|
872
|
+
|
|
873
|
+
- Output format validation (PPM, TIFF)
|
|
874
|
+
- Color space conversion testing (6 color spaces)
|
|
875
|
+
- Bit depth processing (8-bit, 16-bit)
|
|
876
|
+
- Quality setting validation
|
|
877
|
+
- Format header verification
|
|
878
|
+
|
|
879
|
+
- **Thumbnail Extraction Test Suite** (`test/thumbnail-extraction.test.js`)
|
|
880
|
+
|
|
881
|
+
- Thumbnail detection across formats
|
|
882
|
+
- Extraction method validation
|
|
883
|
+
- Format analysis (JPEG, TIFF, PNG, Raw RGB)
|
|
884
|
+
- Performance measurement
|
|
885
|
+
- Data integrity verification
|
|
886
|
+
|
|
887
|
+
- **Comprehensive Test Runner** (`test/comprehensive.test.js`)
|
|
888
|
+
- Integrated test execution
|
|
889
|
+
- Real-world file processing
|
|
890
|
+
- Cross-format validation
|
|
891
|
+
- Performance benchmarking
|
|
892
|
+
|
|
893
|
+
#### ๐ผ๏ธ Advanced Thumbnail Extraction
|
|
894
|
+
|
|
895
|
+
- **Batch Extraction Script** (`scripts/extract-thumbnails.js`)
|
|
896
|
+
|
|
897
|
+
- Automated processing of all RAW files
|
|
898
|
+
- High-quality thumbnail preservation
|
|
899
|
+
- Support for 6+ camera brands
|
|
900
|
+
- Interactive gallery generation
|
|
901
|
+
- Comprehensive reporting
|
|
902
|
+
|
|
903
|
+
- **Interactive Gallery Viewer** (`sample-images/thumbnails/index.html`)
|
|
904
|
+
- Responsive web interface
|
|
905
|
+
- Camera brand filtering
|
|
906
|
+
- File size statistics
|
|
907
|
+
- Thumbnail preview grid
|
|
908
|
+
- Format identification
|
|
909
|
+
|
|
910
|
+
#### ๐ Real-World Validation
|
|
911
|
+
|
|
912
|
+
- **21 RAW files tested** across major camera brands:
|
|
913
|
+
|
|
914
|
+
- Canon CR3 (3 files) - 2.4-2.6 MB thumbnails
|
|
915
|
+
- Nikon NEF (6 files) - 1.1-1.9 MB thumbnails
|
|
916
|
+
- Sony ARW (3 files) - 1.4-6.0 MB thumbnails
|
|
917
|
+
- Fujifilm RAF (3 files) - 2.9-5.5 MB thumbnails
|
|
918
|
+
- Panasonic RW2 (3 files) - 380KB-1MB thumbnails
|
|
919
|
+
- Leica DNG (3 files) - 8.3-13.4 MB thumbnails
|
|
920
|
+
|
|
921
|
+
- **Performance Benchmarks**
|
|
922
|
+
- File loading: 15-30ms (800MB/s+ throughput)
|
|
923
|
+
- Metadata extraction: 1-5ms
|
|
924
|
+
- Thumbnail extraction: 20-50ms (400KB/s+ throughput)
|
|
925
|
+
- Image processing: 1000-2000ms (70-140MB/s throughput)
|
|
926
|
+
- Memory efficiency: No leaks detected
|
|
927
|
+
|
|
928
|
+
#### ๐ ๏ธ Developer Experience
|
|
929
|
+
|
|
930
|
+
- **npm Scripts** for common operations
|
|
931
|
+
|
|
932
|
+
- `npm run extract:thumbnails` - Batch thumbnail extraction
|
|
933
|
+
- `npm run test:image-processing` - Image conversion tests
|
|
934
|
+
- `npm run test:format-conversion` - Format validation tests
|
|
935
|
+
- `npm run test:thumbnail-extraction` - Thumbnail operation tests
|
|
936
|
+
- `npm run test:comprehensive` - Complete test suite
|
|
937
|
+
|
|
938
|
+
- **Documentation** (`docs/TESTING.md`)
|
|
939
|
+
- Comprehensive testing guide
|
|
940
|
+
- Performance metrics
|
|
941
|
+
- Troubleshooting information
|
|
942
|
+
- Extension guidelines
|
|
943
|
+
|
|
944
|
+
### ๐ง Changed
|
|
945
|
+
|
|
946
|
+
#### Enhanced API Interface
|
|
947
|
+
|
|
948
|
+
- **Improved error handling** across all methods
|
|
949
|
+
- **Consistent Promise-based API** for all operations
|
|
950
|
+
- **Better memory management** with automatic cleanup
|
|
951
|
+
- **Enhanced parameter validation** for all inputs
|
|
952
|
+
|
|
953
|
+
#### Performance Optimizations
|
|
954
|
+
|
|
955
|
+
- **Optimized memory usage** for large files
|
|
956
|
+
- **Faster metadata extraction** (sub-5ms)
|
|
957
|
+
- **Efficient thumbnail processing** pipeline
|
|
958
|
+
- **Resource cleanup** improvements
|
|
959
|
+
|
|
960
|
+
### ๐ Fixed
|
|
961
|
+
|
|
962
|
+
#### Stability Improvements
|
|
963
|
+
|
|
964
|
+
- **Memory leak prevention** in all processing paths
|
|
965
|
+
- **Error handling** for corrupted files
|
|
966
|
+
- **Resource cleanup** in error conditions
|
|
967
|
+
- **Thread safety** improvements
|
|
968
|
+
|
|
969
|
+
#### Compatibility Fixes
|
|
970
|
+
|
|
971
|
+
- **Windows platform** optimization and testing
|
|
972
|
+
- **Large file handling** (>100MB RAW files)
|
|
973
|
+
- **Multiple format support** validation
|
|
974
|
+
- **Edge case handling** for unusual files
|
|
975
|
+
|
|
976
|
+
### ๐ Testing Results
|
|
977
|
+
|
|
978
|
+
#### Test Coverage Summary
|
|
979
|
+
|
|
980
|
+
- **โ
100% thumbnail extraction** success rate (21/21 files)
|
|
981
|
+
- **โ
95%+ image processing** success rate
|
|
982
|
+
- **โ
100% metadata extraction** across all formats
|
|
983
|
+
- **โ
0 memory leaks** detected in comprehensive testing
|
|
984
|
+
- **โ
6 camera brands** validated in production
|
|
985
|
+
|
|
986
|
+
#### Performance Metrics
|
|
987
|
+
|
|
988
|
+
| Operation | File Size | Time | Throughput | Success |
|
|
989
|
+
| ------------ | --------- | ------- | ---------- | ------- |
|
|
990
|
+
| File Loading | 25MB | 15-30ms | 800MB/s+ | 100% |
|
|
991
|
+
| Metadata | Any | 1-5ms | - | 100% |
|
|
992
|
+
| Thumbnails | Variable | 20-50ms | 400KB/s+ | 100% |
|
|
993
|
+
| Processing | 6Kร4K | 1-2s | 70-140MB/s | 95%+ |
|
|
994
|
+
|
|
995
|
+
### ๐ Production Readiness
|
|
996
|
+
|
|
997
|
+
This release marks the transition from proof-of-concept to production-ready:
|
|
998
|
+
|
|
999
|
+
- **โ
Complete API Implementation** - All major LibRaw functions
|
|
1000
|
+
- **โ
Comprehensive Testing** - Real-world file validation
|
|
1001
|
+
- **โ
Memory Safety** - No leaks, proper cleanup
|
|
1002
|
+
- **โ
Error Handling** - Graceful failure management
|
|
1003
|
+
- **โ
Performance Validation** - Benchmarked operations
|
|
1004
|
+
- **โ
Documentation** - Complete usage guides
|
|
1005
|
+
|
|
1006
|
+
### ๐ฆ Dependencies
|
|
1007
|
+
|
|
1008
|
+
- **LibRaw 0.21.4** - Core RAW processing library
|
|
1009
|
+
- **Node-API 7.0.0** - Native addon interface
|
|
1010
|
+
- **node-gyp 10.0.0** - Build system
|
|
1011
|
+
|
|
1012
|
+
### ๐ฏ Compatibility
|
|
1013
|
+
|
|
1014
|
+
- **Node.js** 14.0.0 or higher
|
|
1015
|
+
- **Platforms** Windows (tested), macOS, Linux
|
|
1016
|
+
- **Architectures** x64 (tested), ARM64
|
|
1017
|
+
|
|
1018
|
+
---
|
|
1019
|
+
|
|
1020
|
+
## [0.1.33] - 2025-08-22
|
|
1021
|
+
|
|
1022
|
+
### ๐ง Added
|
|
1023
|
+
|
|
1024
|
+
- Initial LibRaw wrapper implementation
|
|
1025
|
+
- Basic metadata extraction
|
|
1026
|
+
- File loading capabilities
|
|
1027
|
+
- Memory management framework
|
|
1028
|
+
|
|
1029
|
+
### ๐ Fixed
|
|
1030
|
+
|
|
1031
|
+
- Build system configuration
|
|
1032
|
+
- Native module loading
|
|
1033
|
+
- Basic error handling
|
|
1034
|
+
|
|
1035
|
+
---
|
|
1036
|
+
|
|
1037
|
+
## [0.1.32] - 2025-08-21
|
|
1038
|
+
|
|
1039
|
+
### ๐ Added
|
|
1040
|
+
|
|
1041
|
+
- Project initialization
|
|
1042
|
+
- LibRaw library integration
|
|
1043
|
+
- Basic Node.js addon structure
|
|
1044
|
+
- Build configuration
|
|
1045
|
+
|
|
1046
|
+
---
|
|
1047
|
+
|
|
1048
|
+
## Upgrade Guide
|
|
1049
|
+
|
|
1050
|
+
### From 0.1.33 to 0.1.34-poc
|
|
1051
|
+
|
|
1052
|
+
This is a major upgrade with significant new functionality:
|
|
1053
|
+
|
|
1054
|
+
#### New Features Available
|
|
1055
|
+
|
|
1056
|
+
```javascript
|
|
1057
|
+
// Thumbnail extraction (new!)
|
|
1058
|
+
const hasThumb = await processor.thumbOK();
|
|
1059
|
+
if (hasThumb) {
|
|
1060
|
+
await processor.unpackThumbnail();
|
|
1061
|
+
const thumbData = await processor.createMemoryThumbnail();
|
|
1062
|
+
await processor.writeThumbnail("thumb.jpg");
|
|
1063
|
+
}
|
|
1064
|
+
|
|
1065
|
+
// Advanced metadata (enhanced!)
|
|
1066
|
+
const advanced = await processor.getAdvancedMetadata();
|
|
1067
|
+
const lens = await processor.getLensInfo();
|
|
1068
|
+
const color = await processor.getColorInfo();
|
|
1069
|
+
|
|
1070
|
+
// Batch thumbnail extraction (new!)
|
|
1071
|
+
// npm run extract:thumbnails
|
|
1072
|
+
```
|
|
1073
|
+
|
|
1074
|
+
#### Testing Capabilities
|
|
1075
|
+
|
|
1076
|
+
```bash
|
|
1077
|
+
# New comprehensive test suites
|
|
1078
|
+
npm run test:image-processing
|
|
1079
|
+
npm run test:format-conversion
|
|
1080
|
+
npm run test:thumbnail-extraction
|
|
1081
|
+
npm run test:comprehensive
|
|
1082
|
+
```
|
|
1083
|
+
|
|
1084
|
+
#### No Breaking Changes
|
|
1085
|
+
|
|
1086
|
+
All existing APIs remain compatible. New functionality is additive.
|
|
1087
|
+
|
|
1088
|
+
---
|
|
1089
|
+
|
|
1090
|
+
## Security
|
|
1091
|
+
|
|
1092
|
+
- **Memory Safety**: All buffer operations are bounds-checked
|
|
1093
|
+
- **Resource Management**: Automatic cleanup prevents resource leaks
|
|
1094
|
+
- **Error Handling**: Graceful failure without crashes
|
|
1095
|
+
- **Input Validation**: All file inputs are validated before processing
|
|
1096
|
+
|
|
1097
|
+
---
|
|
1098
|
+
|
|
1099
|
+
## Performance Notes
|
|
1100
|
+
|
|
1101
|
+
### Optimization Recommendations
|
|
1102
|
+
|
|
1103
|
+
- Use `createMemoryImage()` for in-memory processing
|
|
1104
|
+
- Call `close()` promptly to free resources
|
|
1105
|
+
- Process thumbnails before full images when possible
|
|
1106
|
+
- Use appropriate bit depth (8-bit vs 16-bit) for your needs
|
|
1107
|
+
|
|
1108
|
+
### Benchmarking
|
|
1109
|
+
|
|
1110
|
+
Run the performance test suite to validate on your system:
|
|
1111
|
+
|
|
1112
|
+
```bash
|
|
1113
|
+
npm run test:performance
|
|
1114
|
+
```
|
|
1115
|
+
|
|
1116
|
+
---
|
|
1117
|
+
|
|
1118
|
+
## Contributing
|
|
1119
|
+
|
|
1120
|
+
### Adding New Features
|
|
1121
|
+
|
|
1122
|
+
1. Implement in C++ (`src/libraw_wrapper.cpp`)
|
|
1123
|
+
2. Add JavaScript wrapper (`lib/index.js`)
|
|
1124
|
+
3. Create tests in appropriate test suite
|
|
1125
|
+
4. Update documentation
|
|
1126
|
+
5. Add to this changelog
|
|
1127
|
+
|
|
1128
|
+
### Testing Guidelines
|
|
1129
|
+
|
|
1130
|
+
- All new features must have test coverage
|
|
1131
|
+
- Test with multiple camera brands
|
|
1132
|
+
- Validate memory usage
|
|
1133
|
+
- Include performance benchmarks
|
|
1134
|
+
|
|
1135
|
+
---
|
|
1136
|
+
|
|
1137
|
+
**For detailed API documentation, see [README.md](README.md)**
|
|
1138
|
+
**For testing information, see [docs/TESTING.md](docs/TESTING.md)**
|