Node.js native addon for converting RAW images to JPEG using Core Image
npm install coreimage-raw-convertA Node.js native addon for converting RAW images to various formats using macOS Core Image framework.
- Uses macOS Core Image's CIRAWFilter for RAW processing
- Supports various RAW formats (NEF, CR2, ARW, DNG, RAF, ORF, etc.)
- Objective-C++ addon
- macOS
- Node.js
- Python (for node-gyp)
- Xcode Command Line Tools
Install:
``bash`
npm i coreimage-raw-convert
Use:
`javascript
import fs from 'fs';
import { convertRaw, OutputFormat } from 'coreimage-raw-convert';
// Convert to JPEG
const rawBuffer = fs.readFileSync('photo.dng');
const jpegResult = convertRaw(rawBuffer, OutputFormat.JPEG, {
inputFormat: 'dng',
});
fs.writeFileSync('photo.jpg', jpegResult.buffer);
// Convert to PNG
const pngResult = convertRaw(rawBuffer, OutputFormat.PNG, {
inputFormat: 'dng',
});
fs.writeFileSync('photo.png', pngResult.buffer);
// Convert to TIFF
const tiffResult = convertRaw(rawBuffer, OutputFormat.TIFF, {
inputFormat: 'dng',
});
fs.writeFileSync('photo.tif', tiffResult.buffer);
`
The project includes several TypeScript examples. Use the npm scripts to run them:
`bashConvert a RAW file from command line
npm run example -- input.raw output.jpg
Build from Source
`bash
Install dependencies
npm installConfigure build
npm run configureBuild the addon
npm run build
``BlueOak-1.0.0