Badass JavaScript

A showcase of awesome JavaScript that pushes the boundaries of what's possible on the web, by @devongovett.

Rawson.js: A JavaScript Camera RAW File Viewer Ported with Emscripten

March 5th 2013

Rawson.js, by Franz Buchinger, is a JavaScript renderer for RAW image files in the browser.  It uses an Emscripten port of the dcraw C library to JavaScript to render in a canvas element.  Rawson.js can also extract metadata from RAW images, as you can see in the demo.

image

Thanks to the dcraw C library, Rawson.js enables viewing of RAW images from over 500 different cameras and many file types.  The thing about RAW files is that each manufacturer has their own file format, and libraries and viewers must be updated when new cameras are released.  This is why you will sometimes see operating system updates and other program updates for RAW image support ever now and again.

Rawson.js is currently a bit slow, especially for large images.  The image shown in the screenshot above is almost 30MB and it took about 30 seconds to render on my system.  I have found it to be a lot faster in Firefox Nightly thanks to asm.js I think, so try it there if you can.  It sounds like they are perhaps working on a smarter renderer for the next version of Rawson, that doesn’t have to render the whole image at 100% quality before displaying anything.  My suggestion is to only render the visible parts, perhaps in parallel using Web Workers (which they should use in any case) in tiles if possible.  They’ve also mentioned using the embedded JPEG previews in many RAW files to speed up initial rendering while the real thing is processed.

Once it is sped up a bit using some smarter rendering techniques, I think Rawson will be very important for browser based photo editing applications, since many professionals only work with RAW files for their quality.  You can check out the source on Github, the project page, and the demo.