Lens exif information database

The file containing the lens information is called lensdb.ini. I went for a plain text format, so it can be changed and viewed in a normal text editor without the need for additional software.


The file should be in the folder of the m8raw2dng executable. Otherwise it’s not found. You can add as many entries as you like to the file. An entry contains the following parts (text after % is for explanation and does not go into the actual file):

[000110]                                              % the identifier = the leica 6bit code on your lens. black is 1, white is 0, read in a clockwise manner
Maker = Leica                                   % here you can enter the maker of your lens. Lightroom does not use this info unfortunately though…
Model = Summicron 35/2 V2       %whatever you need to identify the lens. I normally use “lensname focallength/maxfstop”
SerialNo = 1234567                        % that’s optional, but you can use it if you want
FocalLength = 35                             %Focal length in mm, as specified on lens, not adjusted with crop factor
Aperture = 2.0                                  % and here they go… list every aperture you can set on the lens and only those.
Aperture = 2.4                                  % this ensures you’ll never get an image with a lens aperture set to a value
Aperture = 2.8                                  % that you physically can not set on your lens
Aperture = 3.4                                  % btw, I don’t know if the stops are correct for the summicron, as I don’t have it :)
Aperture = 4.0
Aperture = 4.8
Aperture = 5.6
Aperture = 6.7
Aperture = 8.0
Aperture = 9.5
Aperture = 11.0
Aperture = 13.0
Aperture = 16.0

And that’s it. Just follow the examples and fill in your data. Keep the single space before and after the equal sign. Be sure to write the correct 6bit code that you have on your lens, too.

Possibilities & further information

As the raw files are not corrected anyway, you can code the lenses to whatever you want (using a sharpie pen for example) to be able to distinguish them. This makes it finally possible to know when you shot what picture with which lens at what aperture. I additionally borrowed and implemented Sandy McGuffog’s aperture guesstimation formula, which to my experience delivers a pretty good result in many cases, so the aperture is quite on the mark (as long as you don’t use a ND filter :)) I am pretty sure I could make it better, though, if I had a sufficient amount of data. Maybe i get around to do some more testing one day.

Be aware that the M8 does not only check the lens code but also if the frameline lever is in the correct position!
If that doesn’t match, it simply does not record the lens code at all. That was a very bad decision by Leica in my opinion. That means, e.g. that it is not possible to code a 35mm lens with a 50mm code.

Usage with the command line tool

So let’s assume you set up the lensdb.ini correctly. You can now do the normal conversion and add the parameter -l to the switches. m8raw2dng will open a file, check if a lens code was recorded and compare it with the ones in your lens database. If there’s an entry available it will take that information and include it in the resulting DNG.
If there’s no positive match there are two options:

  1. it just doesn’t change anything, except for the g-stop estimation
  2. it uses the lens code you hand over during conversion

The second option is done by forcing a lens code right after the -l switch. So that would be then:

m8raw2dng -l 100010 -b -p -v ...

Note that this code will only be used if there is not a different one found in the file. So you won’t damage good working raw files with an incorrect lens information if you forget to remove the forced lens code.