AWARE SYSTEMS
TIFF and LibTiff Mail List Archive

2015.11.04 22:32 "[Tiff] Wrong data type of GPS_IFD and EXIF_IFD tags and other issues", by

Hello,

I am using LibTiff 4.x versions to save geo-information into the EXIF-GPS tags. Therefore, I added the GPS tags as custom defined tags like the already implemented exifFields.

1.) Occasionally, I recognized that the data type of the tags GPS_IFD and EXIF_IFD are wrongly implemented in the LibTiff. Another tool issues warnings about that.

They are specified as LONG values (see http://www.awaresystems.be/imaging/tiff/tifftags/exififd.html) but in tiff_dirinfo.c their data type is specified as TIFF_IFD8=13 instead of TIFF_LONG=4.

2.) The “#define IGNORE 0” in tif_dirread.c collides with the GPS tag “VersionID=0” and prevents the tag to be read. Therefore, the #define should be redefined for example to “#define IGNORE 65534 //(-2)”

3,) Custom parameters (like the updated GPS tags) are defined using TIFFField entries. Here, the size and parameter type for reading and writing is defined.

I defined the GPS tags for latitude and longitude as custom fields with rational data type and the parameter precision for TIFFSetField() and TIFFGetField() as double-precision.

{GPSTAG_LATITUDE, 3, 3,TIFF_RATIONAL, 0, TIFF_SETGET_C0_DOUBLE, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "Latitude", NULL },

I discovered that the rational values, even when passed or read with double-precision, are internally stored ALLWAYS as floating point single precision in “tif->tif_dir.td_customValues”.

This means that the LibTiff does not allow handling custom defined rational values in double precision, as necessary for latitude and longitude values in GPS tags, even if the rational representation would allow this precision. Therefore I would like to recommend storing custom floating point variables (especially rational values) internal always as double-precision.

I would appreciate, if someone could check that issue.

Regards,

Su