2012.06.16 16:37 "[Tiff] about the TIFFSetField usage", by He Yang

2012.06.18 13:15 "Re: [Tiff] Tiff Digest, Vol 97, Issue 5", by Olivier Paquet

On Sun, Jun 17, 2012 at 3:47 PM, He Yang <he-yang@live.com> wrote: > I  am trying to set the EXIFTAG_EXPOSURETIME,  which is a

TIFF_RATIONAL, there are way to make sure the forward /backward  is conversion are always consistent. Does libtiff provide a way to make sure the rational to float and float to rational, from my tracing,  But I found the precision was lost during read back from the disk file not from the memory?

Not that I know as libtiff stores these as floats (or doubles, I'm not sure) internally and uses a basic conversion method in TIFFWriteDirectoryTagCheckedRational() to write them out as rationals. I think this is where the precision is lost. However, that function could certainly be improved to handle the "1 / x" case with better accuracy as it currently writes out all values < 1 as "x / UINT_MAX". It should be possible to also try "1 / x" and pick the representation with the lowest error. Can you compile your own libtiff to try it if I find some time to write this?

Olivier