Lens not automatically selected

I am using the latest stable release of DT (3.0.2) on windows 10. My camera is a Nikon D5200 an im using 2 prime lenses (Nikkor 35, 50), the kit VR 16-105 and a Tamron 70-300. The Nikkon lenses are detected by the lens correction module and activating the lens correction module applies the undistorition.

My Tamron on the other hand is detected, but i have to choose the lens manually.

The exiv 2 output is

 exiv2 -pt DSC_0127.NEF | grep -ai lens
Exif.Nikon3.LensType                         Byte        1  D G VR
Exif.Nikon3.Lens                             Rational    4  70-300mm F4-5.6
Exif.Nikon3.LensFStops                       Undefined   4  5.91667
Exif.NikonLd3.LensIDNumber                   Byte        1  Tamron SP 70-300mm F4-5.6 Di VC USD
Exif.NikonLd3.LensFStops                     Byte        1  F5.9

Darktable reports:


I then have to select the lens again. Is there any way to tell darktable / lensfun to match this profile with the according exif tag on Windows?


You can either use a .exiv2 file, or you can create a preset.

Thanx! The exiv2 file solution looks like what I want. Will try it

I tried the suggestion with the exiv2 file (using the idea fromhttps://github.com/darktable-org/darktable/issues/4951
and added an exiv2.ini file into my homedir in windows with the following content

Tamron SP 70-300mm F4-5.6 Di VC USD=Tamron SP 70-300mm F4.0-5.6 Di VC USD (A005)

but that won’t work. Is there some easy fix? Or is lens correction a bigger problem?

The idea with the preset is working, thanx!

is it called exiv2.ini or is it called .exiv2? (not a windows user, so I don’t know)

The manual says it’s exiv2.ini

I thought the format of a lens selector in eviv2.ini/.exiv2 should be:
“<code>=<lens description>”
<code> would be the value of Exif.NikonLd3.LensIDNumber (one byte, so between 0 and 255);
<lens description> should be the description for the corresponding lens as used by lensfun

Thanx, i just copied the exiv2 command from somewhere. Now i iknow the t option means human readable format. But changing to

241=Tamron SP 70-300mm F4.0-5.6 Di VC USD (A005)

does not help.
Do i need to install exiv2 besides the darktable version? If so i think i will stick with the Preset or try the lua script i found somewhere in this forum to fix misinterpreted lenses

I checked the behaviour for a sigma lens on canon on win10: exiv2.ini in the users homedirectory is fine.


Thanx everyone.

I read about darktable lens correction pipeline in the manual and i hope i get it right

evix2 reads the metadata and when the lens is know it reports it to lensfun to select the correct lens.

evix2 reports

Exif.NikonLd3.LensIDNumber                   Byte        1  Tamron SP 70-300mm F4-5.6 Di VC USD

or 241as LensIDNumber.

My lens is in the lensfun database

Tamron SP 70-300mm f/4-5.6 Di VC USD

But in darktable in the lenses dropdown menu the lens appears as


I do not have exiv2 installed on my windows system, so im using the one with darktable. I added an exiv2.ini file in my C:\Users\USERNAME directory containing of

241=Tamron SP 70-300mm f/4.0-5.6 Di VC USD (A005)

But nothing happens. I am using DT 3.0.2 release on Windows 10 (2004). Am i missing something obvious?


I just tried the latest nightly (thanks @Quirijn ) and my lens is properly detected. So i just have to be patient it seems :smile:

The exiv2.ini is needed to override the lens identification when darktable imports the exif values. So the term must be changed to match the lensfun term. Usually the exif values are determined only at the initial import - so later changes of exiv2.ini doesn‘t update the metadata shown in darktable. So you need to reimport the affected images

1 Like

Thank you very much! :man_facepalming: i was only restarting darktable each time, but did not know that i had to reimport. Now everything works fine! Sorry for my stupidity :wink:

1 Like