AWARE SYSTEMS
TIFF and LibTiff Mail List Archive

Thread

2017.02.15 13:54 "[Tiff] Incompatibility with unsigned rationals", by Alnahawi, Nouri
2017.02.15 17:20 "Re: [Tiff] Incompatibility with unsigned rationals", by Phil Harvey
2017.02.17 12:54 "Re: [Tiff] Incompatibility with unsigned rationals", by Phil Harvey
2017.03.21 22:06 "Re: [Tiff] Incompatibility with unsigned rationals", by Su

2017.02.17 12:54 "Re: [Tiff] Incompatibility with unsigned rationals", by Phil Harvey

> On Feb 17, 2017, at 4:26 AM, Alnahawi, Nouri <nouri.alnahawi@h-da.de> wrote:

> An example: ExposureTime (defined as TIFF_RATIONAL) with value 1/640 = 0.0015625 is interpreted as -6710886 in IRfanView, whereas it should be 6710886,4294967295 = 1/640. FocalLength (also defined as TIFF_RATIONAL) with value 131.0 = 0,0076335877... is iterpreted correctly. So you can see what I mean :/

I wouldn't call it a bug in libTiff just because IRfanView can't read it, but the LibTiff rationalization algorithm is definitely flawed for other reasons:

  1. Numbers which have exact rational representations may only be approximated (eg. 0.3 can be represented exactly as 3/10, but LibTiff writes 0x4cccccccc/0xffffffff which equals 2.999999999).
  2. Rounding is done by truncation, so the nearest representation (for the given numerator or denominator of 0xffffffff) is only found half of the time.
  3. In the Exif 2.31 specification there are 4 RATIONAL tags for which 0xffffffff in the numerator or denominator has a special meaning:

0x9206 SubjectDistance 0xffffffff in the numerator indicates infinity

0x9401 Humidity        0xffffffff in the denominator indicates unknown
0x9402 Pressure        0xffffffff in the denominator indicates unknown
0x9404 Acceleration    0xffffffff in the denominator indicates unknown

- Phil