lens correction for Leica D-Lux 7

I just acquired a Leica D-Lux 7 compact camera. Now I am wondering how I can tell darktable to do the proper lens correction.

The camera is unknown to darktable resp. lensfun. But it has the same lens and sensor as the Panasonic DMC-LX100 which is known by both apps. If I manually pick the Panasonic lens correction it looks good to me.

But how do I automate this? Here is what I tried but what is not working.

1.) I copied the Panasonic DMC-LX100 settings from the lensfun xml database to a separate file: leica-d7.xml

2.) I changed the name of maker, model and mount option:

        <model>D-Lux 7</model>

        <!-- This calibration works for 3:2 as well as for 4:3 because the crop
             factor is almost the same -->
        <model>D-Lux 7 &amp; compatibles</model>
        <model lang="en">fixed lens</model>
        <model lang="de">festes Objektiv</model>

3.) I placed that file in $HOME/.local/share/lensfun/leica-d7.xml

Now darktable recognizes the model, but not the lens:


I always have to pick the lens manually and then it works with correct focal length and aperture.


What do I need to do so that the lens correction is automatically applied to every picture?

At a guess, perhaps Leica does not call its lens “fixed lens” in the EXIF like Panasonic does, which is why it isn’t found?

I doubt that this is it. I downloaded Panasonic LX100M2 example raw files and they do not even have lens information in the exif. Similar to the Leica. They are fixed lens compact cameras.

I got it working. The issue was the maker name


But it should be:

<maker>LEICA CAMERA AG</maker>


This is doing the trick now. lens correction is applied automatically!


Ah, another maker/model gotcha unfortunately, glad you figured it out.

In dt “normalized/sanitized” names are used for almost everything (see cameras.xml for the mapping), but it looks like lensfun lookup is the exception relying on the raw, unsanitized Exif values…