Lens correction and Embedded Metadata with DNG converted files

I noticed that the Lens Correction module in Darktable 4.2 works great with “embedded metadata” when processing original raw files but if I convert the file to DNG (using either Lightroom or Adobe DNG converter) the module is no longer offering the “embedded metadata” option. I am pretty sure that the lens correction data is still available in the DNG file.

The reason I like to convert the Sony A7RII files to DNG is to save disk space using lossless compression (shrink the files by about 50%, from around 80MB per file to around 40MB).

Any idea if this is something that could be added to a future version of Darktable? Should I open an issue for that in GitHub?

Thanks.

Have you checked first that (1) there is still raw data in your dng and (2) that the metadata is actually carried over?

Hi PaperDigits,

It is lossless raw compressed DNG and I think the lens correction info is present. ExifTool shows this:
Distortion Corr Params : 0 2 12 30 54 86 126 174 228 292 364 448 540 644 756 884
Lens Zoom Position : 98%
Vignetting Corr Params : 0 0 64 160 288 448 640 896 1152 1408 1728 1984 2528 3520 5184 6944
Chromatic Aberration Corr Params: -1150 -1178 -1204 -1220 -1234 -1240 -1240 -1224 -1200 -1154 -1098 -1020 -936 -846 -762 -578 870 834 804 778 756 742 726 696 654 594 524 456 374 270 134 -96

Next question: are those fields from exiftool the same as the original raw file? If no, then the lens correction in DT won’t work.

Impressive PaperDigits! They are indeed different :frowning:

From ARW

  • Vignetting Corr Params : 16 0 0 64 160 288 448 640 896 1152 1408 1728 1984 2528 3520 5184 6944
  • Chromatic Aberration Corr Params: 32 -1152 -1152 -1152 -1280 -1280 -1280 -1280 -1280 -1152 -1152 -1152 -1024 -896 -896 -768 -640 896 896 768 768 768 768 768 640 640 640 512 512 384 256 128 -128
  • Distortion Corr Params : 16 0 2 11 27 49 77 113 156 205 262 327 403 485 579 679 794

From DNG

  • Distortion Corr Params : 0 2 12 30 54 86 126 174 228 292 364 448 540 644 756 884
  • Lens Zoom Position : 98%
  • Vignetting Corr Params : 0 0 64 160 288 448 640 896 1152 1408 1728 1984 2528 3520 5184 6944
  • Chromatic Aberration Corr Params: -1150 -1178 -1204 -1220 -1234 -1240 -1240 -1224 -1200 -1154 -1098 -1020 -936 -846 -762 -578 870 834 804 778 756 742 726 696 654 594 524 456 374 270 134 -96

Even though it saves space, I’d recommend not using DNG. I’d recommend saving the original files from your cameras. If you absolutely need DNGs to gain some compatiblity somewhere, then use them, but IMHO preserving the original files from your camera is paramount. Adobe can tell you what they’re doing with the DNG, but they maybe incorrect, there maybe bugs, etc etc.

It would be sad to get years down the road, having discarded the original files, only to discover that the DNG isn’t suitable for some purpose.

I agree with Mica about not using DNG. The only exception is when you have a RAW file not supported by DT.

Reducing your file size from 80 MB to 40 MB is significant; something must get lost on the way. Not a SONY shooter, but does the camera have the option for DNG?

Hi Bernhard,

No the Sony A7RII doesn’t have a DNG option and its compressed raw is lossy. In the other hand, Adobe Raw converter provides lossless compression, so from the image standpoint, no data should be lost. But it’s another story for the meta-data as it is proprietary and something might be lost in translation.

Ignoring for the moment the fact that exiftool reports a difference in values, the real issue is that Exif MakerNotes (of Sony veriety), that dt knows about and looks for, get moved to a different location called DNGPrivateData not currently being parsed.

In theory this relocation by the DNG Converter should be verbatim, so this might be worth looking into further (using exiv2 though, as that is what dt uses for parsing).

1 Like

Bad news (for now): in the ARW, the lens correction params are duplicated in the SR2 MakerNote sub-directory (in addition to being available in the regular image sub-directory which exiv2/dt read). Here’s from a A7S sample dumped by exiftool -v3:

  | | 21) VignettingCorrection = 511
  | |     - Tag 0x7031 (2 bytes, int16u[1]):
  | |        22d58: ff 01                                           [..]
  | | 22) VignettingCorrParams = 11 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
  | |     - Tag 0x7032 (34 bytes, int16s[17]):
  | |        22dbc: 0b 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 [................]
  | |        22dcc: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 [................]
  | |        22ddc: 00 00                                           [..]
  | | | 203) Sony_SR2SubIFD_0x797c = 511
  | | |     - Tag 0x797c (2 bytes, int16u[1]):
  | | |         c75c: ff 01                                           [..]
  | | | 204) VignettingCorrParams = 11 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
  | | |     - Tag 0x797d (34 bytes, int16s[17]):
  | | |         d2c2: 0b 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 [................]
  | | |         d2d2: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 [................]
  | | |         d2e2: 00 00                                           [..]

The DNG Converter presumably copies this SR2 sub-directory somewhere, but neither exiftool nor exiv2 can’t seem to be able to decode it any longer…

exiftool:

  | | | | Warning = [minor] Bad IDC_IFD SubDirectory start (directory end is 131122 but[snip]
  | | | | 6)  Sony_SR2Private_0x7241 = 0
  | | | |     - Tag 0x7241 (4 bytes, int32u[1]):
  | | | |         ae76: 00 00 00 00                                     [....]
  | | | | Warning = [minor] Bad offset for AdobeSR2 MRWInfo
  | | | | 7)  Sony_SR2Private_0x7250
  | | | |     - Tag 0x7250 (36864 bytes, int16u[18432])
  | | | | 8)  Sony_SR2Private_0x7251 = 0
  | | | |     - Tag 0x7251 (2 bytes, int16u[1]):
  | | | |         ae8e: 00 00                                           [..]
  | | | | Warning = Error reading SR2 data

exiv2:

Error: Directory Sony2 with 25665 entries considered invalid; not read.
1 Like