/m9tools

M9 DNG processing tools

Primary LanguagePythonOtherNOASSERTION

m9tools - metadata processing for the Leica M9

I wasn't able to find any software able to edit the new DNG 1.3 metadata, so here's my attempt. The mdng module is able to read and write arbitrary DNG metadata without altering the image data.

The main motivation was to add the FixBadPixels opcode to my DNG files to map out an intermittent column defect without sending the camera back to Leica.

Warning

This is completely experimental. I've found it useful, and the output files validate successfully, but I don't guarantee it won't destroy your files. Don't ever overwrite your only copy with the output of these tools.

Installation

Requires Python 2.7 or thereabouts; I've only run it on OS X 10.8 but it's a very simple pure Python module.

easy_install pip
pip install git+git://github.com/bendyer/m9tools.git#egg=m9tools

Usage

pixelfix -v -c 1292 -p 1946,3215 L1001234.DNG

The -c option indicates a defect at the specified Bayer column (0-indexed); the -p option indicates a point defect at the specified X,Y coordinates (also 0-indexed). Note that the coordinates are based on the viewable area of the file (excluding the 2-pixel masked border present in the DNG file but not visible in image manipulation programs), and that they reference coordinates in the Bayer array, which depending on the colour may not line up exactly with the position of the defect in a demosaiced RGB image. Either view the original data, or try a couple of pixels around the displayed coordinates until you get it right.

Multiple -c and -p options can be used to map out additional defects.

Compatibility

The mdng module assumes that the DNG format is as generated by the M9, i.e.:

  • The preview image is in IFD 0, and it contains the EXIF and SubIFD tags;
  • The main image is in SubIFD 1, referenced by the preview;
  • Both the preview and main images are stored as a single strip each.

Aside from saving IFDs and data in a somewhat different order to the M9, updating the DNG file version to 1.3.0.0, and obviously appending the OpcodeList1 tag to SubIFD 1, the only change made by this library is to update the XMP tag datatype to 1 (bytes) rather than 5 (string). Although recent versions of the M9 firmware appear not to write that tag at all, older versions write it with the wrong datatype, which causes validation errors in Adobe's dng_validate.

Note: as far as I'm aware, DNG 1.3 opcodes are currently only supported by Adobe's RAW tools (Lightroom and ACR). They don't work at all in Aperture.

License

MIT. See LICENSE for details.