#ifd #tiff #exif #raw #multimedia-encoding

bin+lib dng

A pure Rust library for reading/writing of DNG files, providing access to the raw data

11 stable releases

new 1.6.0 Jul 28, 2026
1.5.4 Sep 29, 2025
1.5.3 May 9, 2025
1.5.2 Aug 12, 2024
1.3.0 Nov 25, 2022

#319 in Images

Download history 23/week @ 2026-04-12 14/week @ 2026-04-19 61/week @ 2026-04-26 117/week @ 2026-05-03 144/week @ 2026-05-10 600/week @ 2026-05-17 26/week @ 2026-05-24 30/week @ 2026-05-31 24/week @ 2026-06-07 27/week @ 2026-06-14 53/week @ 2026-06-21 35/week @ 2026-06-28 22/week @ 2026-07-05 188/week @ 2026-07-12 442/week @ 2026-07-19 318/week @ 2026-07-26

971 downloads per month

AGPL-3.0

110KB
2.5K SLoC

dngcrates-shield docs-shield

A pure Rust, no dependency 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.

The crate 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.

dump_dng

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 (signed) rational 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
  -V, --version                 Print version

compile_dng

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          Write the DCP magic bytes (DNG Camera profile) instead of the DNG ones
  -b, --big-endian   Write a big endian DNG (default: little endian)
  -h, --help         Print help
  -V, --version      Print version

Example:

$ 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–1.5MB
~27K SLoC