Friday, June 24, 2011

Leica M9 DNG to Nikon D3x NEF converter

My workflow has been based on Nikon Capture NX2, I do a quick review the pictures out of the camera with Photomechanic, delete all rubbish, adjust with Capture NX, and review the results again with Photomechanic. I just keep the NEFs, and generate jpgs or tiff on demand for particular files. With the non destructive editing of NX, this is all I need.

With the M9 coming into the scene, things are not so simple for me. The M9 writes a minimalistic DNG file with no JPG preview. That makes a fast review of the pictures very difficult, Lightroom needs to render the JPG on the fly, and Photomechanic only reads the available small thumbnail. To circumvent this, I run the Adobe DNG converter to rewrite the DNG with an embedded JPG preview as a first step before browsing the files.

Then I import into Lightroom and do my adjustments, but Lightroom does not update the JPG preview after the edits, so any external viewer will not see the edited file, which is quite inconvenient.

So, to introduce the M9 files into my usual workflow, instead of duplicating workflows, I have written a tool to convert the Leica M9 files into NEFs.

Given a Nikon D3x NEF file (the template), and one file or a  directory containing Leica M9 DNG files, the tool will create  corresponding NEF files where the following are injected from the DNG file:
  • A JPG preview. This is created using dcraw that you need to have in the path.
  • The RAW data
  • Most of the EXIF parameters
  • The white balance values
The rest will be inherited from the template Nikon file, and that includes all proprietary camera settings and Capture NX controls. You can change the settings of the NEF template before running a conversion, and all newly created files will inherit them.

DNG files need to be OUT OF CAMERA v1.162 M9 firmware files and of UNCOMPRESSED RAW data. Your DNG files will never be modified as they are only read, but other versions may, and compressed files indeed will, not result in an usable NEF file.

Enjoy, and comments welcomed!


  1. Where can I get a Mac OS X compatible copy of dcraw?

  2. Check here,

  3. Es posible que DNG2RAW funcione con archivos de la M8?

    Camera model "M8 Digital Camera" not supported, must be one of
    -M9 Digital Camera
    -Leica X1

    Un saludo.

  4. Me temo que no.

    La M8 tiene 6 bits de color por pixel, que almacena a razón de byte/pixel, y todas las Nikon graban a 12 bits, 3bytes/2pixels, como las M9/X1, o a 14.

    Se podrían escalar los 6 bits de la M8 a los 12 que pide el formato NEF, pero eso ya es alterar/procesar el RAW, y se sale de lo que pretendo hacer con el dng2nef.

    Para eso, quizá sea más apropiado pasar directamente el fichero M8 a tif, y ya trabajarlo en el nx.