Error in the Image Information: 'lens unknown (0x08c3)’

A message about how I solved a not new problem.

I write this up because I could find info about how to solve this problem but searching for it and finding out what exactly to do took quite some time better spent otherwise. Hope it helps others to solve it faster for them through this post.

This is about a Pentax lens but that only matters for practical reasons. It happens to be a HD Pentax DA* 16-50mm F/2.8ED PLM AW to be precise. Thing is that Exiftool decifers it’s metadata correctly where EXIV2 shows an ‘unknown (0x08c3)’ value. darktable uses EXIV2. The’0x08c3’ value does identify this lens by the way.

Why it matters: just identification of the used lens prevents darktable from automatic lens correction which I greatly value.

First I fiddled for some time with lens correction presets. To no avail. Then after a lot of searching and reading used EXIV2 en ExifTool to extract the following:

*$ exiv2 -pv .DNG | grep LensType
_K316855.DNG 0x003f PentaxDng LensType Byte 4 8 195 0 0
_K316856.DNG 0x003f PentaxDng LensType Byte 4 8 195 0 0

$ exiv2 -pt .DNG | grep LensType
_K316855.DNG Exif.PentaxDng.LensType Byte 4 HD Pentax DA
16-50mm f/2.8 ED PLM AW
_K316856.DNG Exif.PentaxDng.LensType Byte 4 HD Pentax DA* 16-50mm f/2.8 ED PLM AW

$ exiftool -LensType .DNG
======== _K316855.DNG
Lens Type : HD PENTAX DA
16-50mm F2.8 ED PLM AW
======== _K316856.DNG
Lens Type : HD PENTAX DA* 16-50mm F2.8 ED PLM AW

In the EXIV2 documentation I found the following info: exiv2/src/pentaxmn_int.cpp at main · Exiv2/exiv2 · GitHub in which is on line 824 the frase: {0x08c3, “HD PENTAX DA* 16-50mm F2.8 ED PLM AW”},

What I learned: the right info is in my picture files but EXIV2 is not able to present the lens correctly in de image information section. Something is wrong, would love to help correcting it.

Needed multiple attempts to correct the situation. Under Linux the way to go is creating a file named .exiv2 in the /home/ folder. Note the leading ‘.’ in it’s name! Under Windows you need to create an ‘exiv2.ini’ file in the users home directory. It’s contents took some experimenting. I finally used this:

[Pentax]
8 195 0 0=HD Pentax DA* 16-50mm f/2.8 ED PLM AW
# 0x08c3=HD Pentax DA* 16-50mm f/2.8 ED PLM AW
# 0x08c3=(0)
# 0x08c3=000

The first line is unfortunately the last I came up with. The other lines are commented out with a ‘#’, those lines may be removed.

As the problem was not resolved during quite some attempts I thought I might need to remove pictures from darktable, remove/rename the connected .xmp files and import again to get the fresh data in the .xmp’s. These steps proved not nessecary but one doesn’t know what exactly to do until being succesfull.

Only the ‘.EXIV2’ file with proper contents for your specific situation is needed together with a refresh of the metadata under ‘actions on selection’/’metadata’-tab in the right hand panel of the lighttable. Of course you need to select all involved pictures first.

Hope to be of some help.

Kind regards, Jetze

We’ve talked about this quite a bit here on this forum:

  1. Exiv2 and Darktable Lens Identification - #2 by paperdigits
  2. My tamron lens is not automatically detected. [solved] - #10 by Claes
  3. updating LensType tag with exiv2/exiftool for Canon RF lens - #7 by asn
  4. Darktable / Lensfun / Canon R6 / Tamron 10-24 EF-S| Lens is included in Lensfun but not accesable in DT - #2 by Macchiato17
  5. Distortion Correction in Darktable - #10 by piratenpanda

Glad you found your way to a solution though.

1 Like

Thank you @paperdigits for giving all these links. As I’ve read them and did not find it easy to find my way. All this info in one thread hopefully helps.

But for all I have to say I’m a relative beginner in darktable which made it a tad more difficult to find my way in de variants and multiple possible solutions. Probably I’m - at least partly - the problem ‘in front of the computer’.

Kind regards, Jetze

1 Like

well then next time you should just ask.

Told him, by Golly … :wink:

1 Like

Of course Mica, I might ask but…

It is my stern feeling better not to ask for the obvious… and first investigate myself. RTFM and subsequent discussions. Learn a bit here and there.

A kind op false(?) pride maybe…

Striking the right balance between trying to do it oneself and asking may never be easy.

Never mind, research was done in good spirit and my write down with good intention.

Regards Jetze

1 Like

It would also be interesting to repeat this experiment (w/o the .exiv2 workaround) w/ PEFs rather than DNGs.

Also, you didn’t say what exiv2 version you’re using.

1 Like

A simpler solution is to rename HD PENTAX-DA* 16-50mm F2.8 ED PLM AW into unknown (0x08c3) in the lensfun database, so:

    <maker>Pentax</maker>
    <model>unknown (0x08c3)</model>
    <mount>Pentax KAF4</mount>

The HD PENTAX-DA* 11-18mm F2.8 ED DC AW will also give problems. Rename HD PENTAX-DA* 11-18mm F2.8 ED DC AW into unknown (0x08c4).

The best way is to copy the entire profile, so you will have two of them: 1. with original name HD PENTAX-DA* 16-50mm F2.8 ED PLM AW 2. with the alternative name unknown (0x08c3). Thus the profile will do its job under all circumstances.

If you go this route you have to rename it every time you update your lensfun database. Don’t really recommend it.

1 Like

That was never a problem for me. Just make a back-up copy of your version of slr-pentax.xml and when there is an update of Lensfun, put back your back-up copy. If there might be a profile of a new lens, simply add it to your own version of slr-pentax.xml.

1 Like

Another Pentaxian?

That’s perfectly doable. Switch my camera to PEF and find out. Will see if I find time for it in the coming days.

(Why) do you expect PEF’s to behave differently?

Used version: exiv2 0.27.6

Regards Jetze

Thanks Matthew,

Would not have thought about doing it this way around… :slight_smile:
I still have to find de Lensfun database though…

Whatever works for you is good, but using the .exiv2 file avoids all this, gets backed up with all my other config files, and means the lens me is shown properly in my editor.

Many years ago I sent test files to Tom Niemann, author of PTLens, and he made the distortion profiles. He worked very accurately. Some distortion profiles in Lensfun are not quite perfect and I replaced them by Tom’s original profiles. These profiles were made before 2009.

Some profiles are not in Lensfun, but the Pentax MX-1 has the same lens as the Olympus XZ-1 and XZ-2, so a profile for the MX-1 is easily made.