2005.08.05 14:03 "[Tiff] DateTime field length", by Ville Herva
I noticed Developer's Image Library (http://openil.sorceforge.net) writes too much data to the TIFF DateTime field. Developer's Image Library uses libtiff, and when I upgraded libtiff to 3.7.3, it began to complain:
TIFFMemFile incorrect count for field "DateTime" (21, expecting 20); tag trimmed
This happens when an image saved with DevIl+libtiff is being opened with DevIl+libtiff.
Now, DevIl writes way too much to the DateTime field - I understand the field is limited to 20 chars (including NUL) in TIFF. But would it make sense to make libtiff truncate the excess bytes when writing (and/or warn about it) so that it wouldn't produce tiff files it'll complain about when opening them?
As for DevIl, something like this is probably needed:
--- ../orig/DevIL-1.6.7/src-IL/src/il_tiff.c 2004-05-12 22:45:16.000000000 +0300
+++ src-IL/src/il_tiff.c 2005-08-05 11:41:04.239343300 +0300
@@ -808,7 +852,10 @@ char *iMakeString()
#endif
CurTime = localtime(&Time);
- strftime(TimeStr, 255, "%s (%z)", CurTime); // "%#c (%z)" // %s wa
s %c
+ strftime(TimeStr, 255, "%H:%M:%S %d.%m.%Y (%z)", CurTime); // "%#c (%z)"
// %s was %c
+
+ // The TIFF DATETIME field is max 20 chars, unfortunately.
+ TimeStr[19] = '\0';
return TimeStr;
}
-- v --
v@iki.fi