#tiff #raw #exif #file-metadata #ifd

bin+lib dng

A pure rust library for reading / writing DNG files providing access to the raw data

8 stable releases

1.5.2 Aug 12, 2024
1.5.1 Aug 6, 2023
1.5.0 Jan 23, 2023
1.3.0 Nov 25, 2022

#214 in Images

23 downloads per month

AGPL-3.0

110KB
2K SLoC

DNG-rs   crates-shield docs-shield

A pure rust library for reading / writing DNG files providing access to the raw data in a zero-copy friendly way. Also containing code for reading / writing a human-readable YAML representation of DNG tags / the IFD structure. DNG-rs also supports interacting with DCP (Dng Camera Profile) files, but that is on a best-effort basis since I was unable to find official documentation on that.

Tools

This library also contains a pair of cli tools for converting a DNG into a human-readable YAML representation and back. These are kind of similar to dcpTool's -d and -c but use YAML rather than XML.

$ target/debug/dump_dng -h                                           
Dump the IFD metadata of a TIFF / DNG image to a human readable yaml representation

Usage: dump_dng [OPTIONS] <FILE>

Arguments:
  <FILE>  input file to get the metadata from

Options:
  -f, --dump-rational-as-float  convert Rational and SRational types to float for better readability (this is lossy)
  -e, --extract                 extract strips, tiles and larger blobs into a directory. also write the ifd chain as a yaml file there
  -h, --help                    Print help information
  -V, --version                 Print version information

$ target/debug/compile_dng -h 
Assemble a DNG file from some of other dng files, plain raw files and metadata

Usage: compile_dng [OPTIONS] --yaml <YAML>

Options:
      --yaml <YAML>  input YAML file to get the metadata from
      --dcp          
  -b, --big-endian   
  -h, --help         Print help information
  -V, --version      Print version information

example:

$ target/debug/dump_dng src/yaml/testdata/axiom_beta_simulated.dcp -f 
UniqueCameraModel: "AXIOM Beta"
ProfileName: "AXIOM Beta spectral simulated"
ProfileEmbedPolicy: allow copying
CalibrationIlluminant1: StandardIlluminantA
ColorMatrix1: [
  2.698, -1.8779, 0.3348,
  0.493, 0.0325, 0.2078,
  0.2645, -0.1286, 0.3895,
]
CalibrationIlluminant2: D65Illuminant
ColorMatrix2: [
  2.5136, -1.2873, -0.1654,
  0.2275, 0.5494, 0.0929,
  0.1393, 0.0697, 0.4617,
]

Current Status

This library should be in a usable state for many applications. However, a more high-level API is not implemented (yet?). For that (and support for other raw formats) you might want to use rawloader.

Dependencies

~0.3–2MB
~39K SLoC