zfedoran / Dcraw.js
Licence: gpl-2.0
Decode or convert RAW camera images using JavaScript
Stars: ✭ 30
Programming Languages
c
50402 projects - #5 most used programming language
Labels
Projects that are alternatives of or similar to Dcraw.js
Brfv4 javascript examples
BRFv4 - HTML5/Javascript - examples project. Reference implementation for all other platform example packages.
Stars: ✭ 460 (+1433.33%)
Mutual labels: emscripten
Ouzel
C++ game engine for Windows, macOS, Linux, iOS, tvOS, Android, and web browsers
Stars: ✭ 607 (+1923.33%)
Mutual labels: emscripten
Tomb5
Tomb Raider: Chronicles Disassembly translated to C source code.
Stars: ✭ 397 (+1223.33%)
Mutual labels: emscripten
Imgui Js
JavaScript bindings for Dear ImGui using Emscripten and TypeScript
Stars: ✭ 510 (+1600%)
Mutual labels: emscripten
Glfm
OpenGL ES and input for iOS, tvOS, Android, and WebGL
Stars: ✭ 364 (+1113.33%)
Mutual labels: emscripten
Camaro
camaro is an utility to transform XML to JSON, using Node.js binding to native XML parser pugixml, one of the fastest XML parser around.
Stars: ✭ 438 (+1360%)
Mutual labels: emscripten
Glchaos.p
3D GPUs Strange Attractors and Hypercomplex Fractals explorer - up to 256 Million particles in RealTime
Stars: ✭ 590 (+1866.67%)
Mutual labels: emscripten
Humblenet
a cross-platform networking library that works in the browser
Stars: ✭ 515 (+1616.67%)
Mutual labels: emscripten
Imguifiledialog
File Dialog for ImGui : https://github.com/aiekick/ImGuiFileDialog
Stars: ✭ 398 (+1226.67%)
Mutual labels: emscripten
Securityworker
The best javascript code protection solution ever.
Stars: ✭ 626 (+1986.67%)
Mutual labels: emscripten
Deepminer
deepMiner webminer proxy (update for cryptoNight R)
Stars: ✭ 497 (+1556.67%)
Mutual labels: emscripten
Lua.vm.js
The project is superceded by Fengari. See https://fengari.io/
Stars: ✭ 812 (+2606.67%)
Mutual labels: emscripten
Pce
Emulates Mac Plus, PC, & Atari ST in the browser using WebAssembly
Stars: ✭ 659 (+2096.67%)
Mutual labels: emscripten
Binaryen
Compiler infrastructure and toolchain library for WebAssembly
Stars: ✭ 5,294 (+17546.67%)
Mutual labels: emscripten
dcraw.js
Convert RAW camera images using JavaScript (supported on Node.js and your Browser)
This project is a port of dcraw.c using Emscripten.
Install:
Node.js
npm install dcraw
Browser
<script src="https://cdn.jsdelivr.net/npm/dcraw"></script>
Usage
Read a RAW image file into a buffer (or Uint8Array
in the browser, see browser example here)
const fs = require('fs');
const buf = fs.readFileSync('./example.CR2');
Get Image Metadata
Parse the file for metadata
const dcraw = require('dcraw');
dcraw(buf, { verbose: true, identify: true });
Result
> Filename: raw_buf
Timestamp: Thu Sep 21 07:17:42 2017
Camera: Canon EOS 20D
Owner: unknown
ISO speed: 3200
Shutter: 252.0 sec
Aperture: f/inf
Focal length: 0.0 mm
Embedded ICC profile: no
Number of raw images: 1
Thumb size: 1536 x 1024
Full size: 3596 x 2360
Image size: 3522 x 2348
Output size: 3522 x 2348
Raw colors: 3
Filter pattern: RG/GB
Daylight multipliers: 2.098645 0.930145 1.180146
Camera multipliers: 1021.000000 1015.000000 1018.000000 1015.000000
Convert to TIFF
Convert to TIFF file, and save to disk
const tiffFile = dcraw(buf, { exportAsTiff: true });
fs.writeFileSync('example.tiff', tiffFile)
Options
You may use the same options that dcraw supports by providing the flags directly, or you may use the following human friendly versions.
Example
// The following dcraw command, can be written two ways using dcraw.js
// dcraw -T -4 -E <filename>
// Both of these do the same thing
dcraw(buf, { T: true, 4: true, E: true });
dcraw(buf, { exportAsTiff: true, use16BitLinearMode: true, useExportMode: true });
Options List
Option | Type | Description |
---|---|---|
verbose | boolean | Print verbose messages |
identify | boolean | Identify files without decoding them (use with '-v' to identify files and show metadata) |
extractThumbnail | boolean | Extract embedded thumbnail image |
useCameraWhiteBalance | boolean | Use camera white balance, if possible |
useAverageWhiteBalance | boolean | Average the whole image for white balance |
whiteBalanceBox | x y w h | Average a grey box for white balance |
useCustomWhiteBalance | r g b g | Set custom white balance |
useEmbeddedColorMatrix | boolean | Use/don't use an embedded color matrix |
correctChromaticAberration | r b | Correct chromatic aberration |
deadPixelFile | buffer | Fix the dead pixels listed in this file |
darkFrameFile | buffer | Subtract dark frame (16-bit raw PGM) |
setDarknessLevel | num | Set the darkness level |
setSaturationLevel | num | Set the saturation level |
setWaveletThreshold | num | Set threshold for wavelet denoising |
setHighlightMode | [0-9] | Highlight mode (0=clip, 1=unclip, 2=blend, 3+=rebuild) |
setFlipMode | [0-7] | Flip image (0=none, 3=180, 5=90CCW, 6=90CW) |
setColorSpace | [0-6] | Output colorspace (raw,sRGB,Adobe,Wide,ProPhoto,XYZ,ACES) |
setICCFromFile | buffer | Apply output ICC profile from file |
setICCFromCamera | buffer | Apply camera ICC profile from file or "embed" |
useDocumentMode | boolean | Document mode (no color, no interpolation, no debayer) |
useRawMode | boolean | Document mode without scaling (totally raw) |
useExportMode | boolean | Document mode without cropping |
setNoStretchMode | boolean | Don't stretch or rotate raw pixels |
setNoAutoBrightnessMode | boolean | Don't automatically brighten the image |
setBrightnessLevel | num | Adjust brightness (default = 1.0) |
setCustomGammaCurve | p ts | Set custom gamma curve (default = 2.222 4.5) |
setInterpolationQuality | [0-3] | Set the interpolation quality |
setHalfSizeMode | boolean | Half-size color image (twice as fast as "-q 0") |
setFourColorMode | boolean | Interpolate RGGB as four colors |
setMedianFilter | num | Apply a 3x3 median filter to R-G and B-G |
setImageCount | [0..N-1] | Select one raw image or "all" from each file |
use16BitMode | boolean | Write 16-bit instead of 8-bit |
use16BitLinearMode | boolean | Linear 16-bit, same as "-6 -W -g 1 1" |
exportAsTiff | boolean | Write TIFF instead of PPM |
Browser Example
You'll need to do a little bit of work to get a file buffer on the browser. There is a full example available here.
var reader = new FileReader();
reader.onload = function (e) {
// Get the image file as a buffer
var buf = new Uint8Array(e.currentTarget.result);
// Get the RAW metadata
const metadata = dcraw(buf, { verbose: true, identify: true });
};
reader.readAsArrayBuffer(file);
Note that the project description data, including the texts, logos, images, and/or trademarks,
for each open source project belongs to its rightful owner.
If you wish to add or remove any projects, please contact us at [email protected].