Leica Lossless Image Compression in the M10


Jul 7, 2010
The M10 offers Compressed DNG only, uses the JPEG lossless compression scheme that is documented in the Adobe Specification for DNG format:


My reasoning is simple: that's the lossless compression scheme defined in the DNG standard, and existing software can process the DNG files from the M10. Leica did not use a proprietary scheme, if they had: we'd all be waiting for new software from Adobe and others to process it. Just like reading M Monochrom files using Photoshop CS2. It works because Leica followed the standard.

This scheme is not based on the Discrete Cosine Transform (DCT). It uses variable length Huffman code and optional predictors. Funny that one of them is horizontal difference frames, ie Running Differences across a row in the image. That is an algorithm that I coded up almost 30 years ago in Fortran. That is the algorithm that Leica should have used in the M8. The algorithm is lossless, the size of the data file is based on scene content. The size of the file required to store an image can exceed what is required of an uncompressed image; I suspect the firmware must have a decision point to store the uncompressed image rather than use the compression scheme. PKZIP makes this decision, will "store" a file rather than compress the file. The instantaneous data rate output by the algorithm will vary based on scene content. Some careful throttling and multi-level buffering should be used to avoid straining the power supplies and inducing noise. This was the case using fast SD cards on the M9 and M Monochrom at High-ISO.

ANYWAY: I personally prefer uncompressed RAW format on the Df, and would have liked the option on the M10. A personal preference driven by decades of writing image processing code.

1) easier to get useful data out of damaged files;

2) easier to write code to unpack the images;

3) more of a steady-state as data flows through the electronics of the camera. Data bursts tend to create noise, noise tends to creep into the image. It may never happen on the M10, but when shooting ISO 12500+ system noise is a significant factor.

I once had a project (1990) where you had to compute peak data rates of multiple systems carrying lossless/compressed data. The burstiness is driven by the scene-content. Played hell with data going through a network switch when something interesting came into the field-of-view. The models showed the probability of dropping data was highest when the sensors picked up "incoming".

More information on DNG tags can be found here:

TIFF tags

I used this website as my primary source of information for writing the DNG unpack/pack routines for the M9, M8, and M Monochrom.

A good write-up, including free source code for the lossless compression scheme is here:

How DNG compresses raw data with lossless JPEG92 - ThNdl

He has a link to the JPEG spec,


Good stuff...
Last edited by a moderator:

Latest threads

Top Bottom