I am finally able to enjoy cr3 files straight from camera with the new darktable 3.8. However I can see a bit of confusion in my library:
One of the reason is that only the most recent files are cr3, the others are dng converted with dnglab.
The most problematic are the photos that dt thinks that have been taken with the 50mm f1.2 – which I don’t have. In fact all the 50mm photos are all taken with the same 50 mm f1.8. The problem is that lens corrections are not automatically applied in this case.
So I thought to manually fix the offending tag but I’m unable to do so, both with exiv2 and exiftool.
$ exiv2 -vk -M'del Exif.CanonCs.LensType' 20211009_CRP2746.cr3
File 1/1: 20211009_CRP2746.cr3
Del Exif.CanonCs.LensType
Exiv2 exception in modify action for file 20211009_CRP2746.cr3:
Setting Image comment in BMFF images is not supported
$ exiv2 -vk -M'set Exif.CanonCs.LensType "Canon RF50mm F1.8 STM"' 20211009_CRP2746.cr3File 1/1: 20211009_CRP2746.cr3
Set Exif.CanonCs.LensType "Canon RF50mm F1.8 STM" (SShort)
Warning: Exif.CanonCs.LensType: Failed to read Short value "Canon RF50mm F1.8 STM"
Exiv2 exception in modify action for file 20211009_CRP2746.cr3:
Setting Image comment in BMFF images is not supported
Exif.CanonCs.LensType is not a text field but a number, as you can see with exiv2:
Exif.CanonCs.LensType Short
Both exiv2 and exiftool “translate” this number in a more readable name. I think for this, they use the number but also other data (like focale length), because this number is not unique between different lens.
In particular, Exif.CanonCs.LensType is always the same 61182 number for all RF lenses (Exif.CanonFi.RFLensType contains a different number for each RF lenses however).
Anyway, you won’t be able to change it like this (and you probably shouldn’t try to modify you cr3 file).
I encounter the same problem you have with Canon RF50mm F1.8 STM being recognised as Canon RF 50mm F1.2L USM. I described here what I currently do to corrected this (each time I import new files taken with this lens, for now):
@paperdigits wrote this .exiv2 file could be filed with another metadata parameter (which could avoid doing the cumbersome steps I explained), but I must admited I didn’t manage to make it work.
There is this PR for exiv2 about Canon lens identification: https://github.com/Exiv2/exiv2/pull/1692
It has already been merged in june, but not in last stable release of exiv2 V0.27.5.
I have been wondering if it would correct this problem: I just tried to compile it and I can confirm it works! It should be in exiv2 V1.00, in a few month hopefully
Following @Peter comment here, I tried to write in the .exiv2 file : 61182=000.
It does what @Peter described: the lens name in darktable then inherite the Exif.Canon.LensModel, so “RF50mm F1.8 STM” (instead of “Canon RF50mm F1.8 STM” with exiv2 master), like you dng file @aadm. Lensfun is able to recognised it (because there is an alias in the lensfun database, I think). I think I won’t use that solution because I’d rather have 1 name for 1 lens in the end, but it works if it’s purely for lensfun.
Yes, sorry, I not been really clear: you will indeed see “RF50mm F1.8 STM” as lens in darktable! But you will have “RF50mm F1.8 STM” with this ‘trick’ (without “Canon” at the beginning) and “Canon RF50mm F1.8 STM” with the new exiv2 (current master or V1.00), as with other Canon RF lenses.
It’s no a big deal, but you will have two different lenses names in darktable for the same lens, as posted by @addm in the first post.
CONFIGURATION FILE
Exiv2 can read an optional configuration file ~/.exiv2 on Unix systems and %USERPROFILE%\exiv2.ini on Windows (using a Visual Studio build). Cygwin and MinGW/msys2 follow the unix convention and
use ~/.exiv2 You can determine the location of the configuration file with the command:
$ exiv2 --verbose --version --grep config_path
exiv2 0.27.0.1
config_path=/Users/rmills/.exiv2
The purpose of the configuration file is to define your own lenses for recognition by Exiv2. The configuration file is in Windows .ini format and has sections for each of the major camera manufac‐
tures canon,nikon,pentax,minolta,olympus and sony. The lens metadata is stored as a integer called the lensID. You can change the lens name associated with any lensID.
$ cat ~/.exiv2
[nikon]
146=Robin's Sigma Lens <--- The name of your lens
You obtain the lensID for your camera with the command:
$ exiv2 -pv --grep lens/i http://clanmills.com/Stonehenge.jpg
0x0083 Nikon3 LensType Byte 1 14
0x0084 Nikon3 Lens Rational 4 180/10 2500/10 35/10 63/10
0x008b Nikon3 LensFStops Undefined 4 55 1 12 0
0x000c NikonLd3 LensIDNumber Byte 1 146 <--- This number
0x000d NikonLd3 LensFStops Byte 1 55
well that worked! I made an .exiv2 with simply 61182=000 under [canon] and now darktable recognizes correctly all the lenses, so lensfun gets activated for all the photos taken with my 50/1.8!
PS: I did update a few tags however related to dngs created at various times with dnglab – or cr3 extracted from those dngs later… they were also creating chaos, but now after a bit of tinkering on the command line, e.g.:…