Skip to main content

Crate rawler

Crate rawler 

Source
Expand description

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

§Example

use std::env;
use std::fs::File;
use std::io::prelude::*;
use std::io::BufWriter;

fn main() {
  let args: Vec<_> = env::args().collect();
  if args.len() != 2 {
    println!("Usage: {} <file>", args[0]);
    std::process::exit(2);
  }
  let file = &args[1];
  let image = rawler::decode_file(file).unwrap();

  // Write out the image as a grayscale PPM
  let mut f = BufWriter::new(File::create(format!("{}.ppm",file)).unwrap());
  let preamble = format!("P6 {} {} {}\n", image.width, image.height, 65535).into_bytes();
  f.write_all(&preamble).unwrap();
  if let rawler::RawImageData::Integer(data) = image.data {
    for pix in data {
      // Do an extremely crude "demosaic" by setting R=G=B
      let pixhigh = (pix>>8) as u8;
      let pixlow  = (pix&0x0f) as u8;
      f.write_all(&[pixhigh, pixlow, pixhigh, pixlow, pixhigh, pixlow]).unwrap()
    }
  } else {
    eprintln!("Don't know how to process non-integer raw files");
  }
}

Re-exports§

pub use decoders::Orientation;
pub use rawimage::RawImage;
pub use rawimage::RawImageData;

Modules§

analyze
bitarray
bits
Low-level bit operations
buffer
cfa
Color Filter Array (CFA)
decoders
decompressors
Decompressors for image codecs.
devtools
dng
exif
formats
imgop
lens
ljpeg92
Lossless JPEG (LJPEG) compressor
pixarray
pumps
rawimage
Raw image
rawsource
Image source like file or buffer
tags
tiles

Macros§

alloc_image
alloc_image_f32_plain
alloc_image_ok
alloc_image_plain
alloc_image_plain_typed
alloc_image_typed_ok
inspector

Enums§

RawlerError

Traits§

ReadTrait

Functions§

decode
Take a readable source and return a decoded image or an error
decode_file
Take a path to a raw file and return a decoded image or an error
get_decoder
global_loader
raw_image_count_file

Type Aliases§

Result