Project

General

Profile

Bug #1083

Exiv2::focalLength returns multiple values for CRW files

Added by Pedro Côrte-Real over 6 years ago. Updated about 6 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
not-a-bug
Target version:
Start date:
17 May 2015
Due date:
% Done:

100%

Estimated time:

Description

For CRW files1 Exiv2::focalLength returns 4 unsigned short values in total in the form [0, X, 914, 610] where X is the actual focal length. The exiv2 tool seems to do the right thing and report X but a naive implementation that just does getFloat() will get 0 instead of X. It would probably make more sense to return X directly unless the other values actually mean anything.

In darktable I just fixed it by taking the first non-zero value2, but that could very well be wrong in some cases still.

[1] http://rawsamples.ch/raws/canon/300d/RAW_CANON_300D.CRW
[2] https://github.com/darktable-org/darktable/commit/ab59f7c6fbc7f86821576100ff4ea9779bc4e719

History

#1

Updated by Pedro Côrte-Real over 6 years ago

exiftool seems to think the second value is the focal length and the other two are the sensor width and height:

http://www.sno.phy.queensu.ca/~phil/exiftool/canon_raw.html

#2

Updated by Robin Mills about 6 years ago

  • Category changed from image format to not-a-bug
  • Status changed from New to Closed
  • Assignee set to Robin Mills
  • Target version set to 0.26

Exiv2 correctly lists the information in the file:

714 rmills@rmillsmbp:~/Downloads $ exiv2 -pv -g Focal RAW_CANON_300D.CRW 
0x0002 Canon        FocalLength                 Short       4  0 36 914 610
715 rmills@rmillsmbp:~/Downloads $ 
If can wanted to report an array of 4 shorts, that is what they have chosen to do. Exiv2 is not a metadata policeman, he reports what is in the file.

#3

Updated by Pedro Côrte-Real about 6 years ago

Calling tag 0x1029 or the CRW format FocalLength was exiv2's decision it's not a particularly good name as the focal length is the second value and there are two other potentially useful values there. Additionally even if you want the tag to return the 4 values surely focalLength(), if it's going to be useful, needs to actually deal with the quirks each format has. For the CRW format that means taking the second value in that tag.

#4

Updated by Robin Mills about 6 years ago

  • % Done changed from 0 to 100
#5

Updated by Pedro Côrte-Real about 6 years ago

This makes no sense but we need to carry the workaround for this bug for existing versions anyway...

https://github.com/darktable-org/darktable/blob/master/src/common/exif.cc#L474-L477

Also available in: Atom PDF