rawloader
This is a rust library to extract the raw data and some metadata from digital camera images. Given an image in a supported format and camera you will be able to get everything needed to process the image:
- Identification of the camera that produced the image (both the EXIF name and a clean/canonical name)
- The raw pixels themselves, exactly as encoded by the camera
- The number of pixels to crop on the top, right, bottom, left of the image to only use the actual image area
- The black and white points of each of the color channels
- The multipliers to apply to the color channels for the white balance
- A conversion matrix between the camera color space and XYZ
- The description of the bayer pattern itself so you'll know which pixels are which color
Additionally it includes a simple raw processing pipeline that does the following:
- Demosaic
- Black and whitelevel application
- Whitebalance
- Convert from camera space to Lab
- Apply a contrast curve to the L channel
- Convert from Lab to Rec709
- Apply sRGB gamma for output
Current State
The library is still a work in process with the following formats already implemented:
- Minolta MRW
- Sony ARW, SRF and SR2
- Mamiya MEF
- Olympus ORF
- Samsung SRW
- Epson ERF
- Kodak KDC
- Kodak DCS
- Panasonic RW2
Usage
Here's a simple sample program that uses this library:
use env;
use File;
use *;
use BufWriter;
extern crate rawloader;
use decoders;
To do the image decoding decode the image the same way but then do:
// Decode to at least full HD size or full image if it's smaller
let decoded = simple_decode;
let mut f = new;
let preamble = format!.into_bytes;
f.write_all.unwrap;
for pix in decoded.data
And this will write out an 8bit RGB image. Reducing the decode size makes the processing much faster by doing the scaling extremely early in the processing (at the demosaic). So this can be used quite directly to do fast thumbnailing of raw images. A 24MP raw file can be turned into a 500x500 thumbnail in 200-300ms on normal laptop hardware.
Contributing
Bug reports and pull requests welcome at https://github.com/pedrocr/rawloader