Metadata for “manual” lenses

Hi,
I occasionally use some vintage lenses, which don’t have any electronics and don’t supply any data to camera’s software. Olympus cameras (and probably most other) allow to create entries with Lens name, Focal distance and Aperture and then choose that setting when using the lens. Lens name then can be found in the metadata of RAW as, for example:

0xa434 Photo  LensModel  Ascii 32  Miida 135mm 1:2.8

0xa434 Photo  LensModel  Ascii 32  OM-System Zuiko MC Auto-T 135mm

Focal distance and Aperture (F Number) also appear in metadata. All are present in JPG exported from darktable. Also all are automatically used when, for example, uploaded to Flickr. However darktable interface doesn’t show the Lens name –

dt_metadata_Screen_20240725_202546

– as it is relying on other Exif field(s) for lens ID. In case of Olympust it may be Exif.OlympusEq.LensType.

May not be a huge issue, but sometimes it is. For instance, when comparing images taken with two 135mm/2.8 vintage lenses (Miida and OM Zuiko) the image info in darktable is identical. So then, in darktable, it’s hard to tell which lens was used for that particular image.

Has anyone run into similar situation? Any ways to make info from Photo.LensModel field visible somewhere?

1 Like

You could use a lua script and exiftool to get the data from the raw and populate the database fields.

1 Like

Same here. Exif tags are a science of its own. I use very often manual lenses. They do not supply any exif data to the raw files.
Before importing into dt, I run a script with which exiftool writes the required data into the raw files. In my opinion, there are several lens tags in a raw file. You need to write the right tag for dt.

LModelNeu="Voigtländer Heliar Classic 50mm f1.5 VM"
LMakeNeu="Cosina/Voigtländer"
LInfoNeu="50mm f/1.5"
MaxApNeu="1.5"

for thefile in *DNG; do
    exiftool -q -q -m -LensModel="$LModelNeu" $myfile \
    -LensMake="$LMakeNeu" $thefile \
    -LensInfo="$LinfoNeu" $thefile -MaxApertureValue="$MaxApNeu" $thefile  "-FileModifyDate<DateTimeOriginal" "-FileModifyDate<CreateDate" $thefile \
    -FLength=50.0mm \
    -FocalLength=50.0mm -Lens=50.0mm -minFocalLength=50 -maxFocalLength=50  $thefile
done

2 Likes

I don’t mind modifying RAW (there are unmodified original copies anyway) and I actually tried writing into LensModel tag, but the ‘lens’ still remains ‘None’ in darktable’s ‘image information’. Using darktable 4.8 though, not git current…

you have to select the image then use the refresh EXIF data in the actions on selected images module

Yes, I did try that, with no change. Though in a testing setup like this I usually just delete ~/.config/darktable/, then all .xmp and import anew…

Did you write into LensModel or Lens Model tag. Dumping EXIF data from images shows the Lens Model tag

1 Like

This may explain it. darktable/src/common/exif.cc:

   else if(FIND_EXIF_TAG("Exif.OlympusEq.LensType"))
    {
      // For every Olympus camera Exif.OlympusEq.LensType is present.
      _strlcpy_to_utf8(img->exif_lens, sizeof(img->exif_lens), pos, exifData);

      // We have to check if Exif.OlympusEq.LensType has been translated by
      // Exiv2. If it hasn't, fall back to Exif.OlympusEq.LensModel.
      std::string lens(img->exif_lens);
      if(std::string::npos == lens.find_first_not_of(" 1234567890"))
      {
        // Exif.OlympusEq.LensType contains only digits and spaces.
        // This means that Exiv2 couldn't convert it to human readable form.
        if(FIND_EXIF_TAG("Exif.OlympusEq.LensModel"))
        {
          _strlcpy_to_utf8(img->exif_lens, sizeof(img->exif_lens), pos, exifData);
        }
 ... ... ...

With no data from the lens firmware, OM puts 0 0 0 0 0 0 into Lens Type tag, which is interpreted as None by Exiv2 and the if(std::string::npos == lens.find_first_not_of(" 1234567890")) doesn’t match and LensModel is not used…