Skip to main content

Crate zenraw

Crate zenraw 

Source
Expand description

Camera RAW and DNG decoder with zenpixels integration.

Multiple decode backends available:

  • rawloader (default) — lightweight, Bayer-only, ~200 cameras
  • rawler — broader support: CR3, X-Trans, JXL-compressed DNG, ~300+ cameras
  • darktable — shells out to darktable-cli for 900+ cameras with full pipeline

Output is controlled by OutputMode:

  • Develop (default): display-ready u16 sRGB
  • Linear: scene-referred linear f32
  • CameraRaw: raw camera f32 values

§Supported formats

  • DNG (Adobe Digital Negative, including iPhone ProRAW with rawler)
  • CR2 (Canon)
  • CR3 (Canon, with rawler)
  • NEF/NRW (Nikon)
  • ARW/SRF/SR2 (Sony)
  • RAF (Fujifilm)
  • RW2 (Panasonic/Leica)
  • PEF (Pentax)
  • ORF (Olympus)
  • ERF (Epson)
  • 3FR (Hasselblad)
  • IIQ (Phase One)
  • And many more

§Quick start

use zenraw::{decode, RawDecodeConfig};
use enough::Unstoppable;

let data: &[u8] = &[]; // your RAW file bytes
let output = decode(data, &RawDecodeConfig::default(), &Unstoppable)?;
println!("{}x{} {}", output.info.width, output.info.height, output.info.model);

§Processing pipeline

  1. Parse camera RAW file
  2. Normalize sensor values using black/white levels
  3. Demosaic Bayer CFA pattern → RGB (Malvar-He-Cutler by default)
  4. Apply white balance coefficients
  5. Apply camera→XYZ→sRGB color matrix
  6. Optionally apply sRGB gamma curve
  7. Optionally apply crop from camera metadata

Re-exports§

pub use classify::FileFormat;
pub use classify::classify;
pub use decode::OutputMode;
pub use decode::RawDecodeConfig;
pub use decode::RawDecodeOutput;
pub use decode::RawInfo;
pub use decode::SensorLayout;
pub use demosaic::DemosaicMethod;
pub use dng_render::OutputPrimaries;

Modules§

classify
File format classification for RAW, DNG, and Apple container formats.
color
Color processing pipeline for camera RAW data.
decode
RAW/DNG decoding to zenpixels buffers.
demosaic
Bayer pattern demosaicing algorithms.
dng_render
DNG rendering pipeline following Adobe DNG SDK specification.

Enums§

RawError
Errors from RAW/DNG decode operations.

Functions§

decode
Decode a RAW/DNG file to a pixel buffer.
is_raw_file
Detect whether a byte slice looks like a supported RAW/DNG file.
probe
Probe a RAW/DNG file for metadata without decoding pixels.

Type Aliases§

Result
Result type alias for zenraw operations.