AWARE [SYSTEMS] Imaging expertise for the Delphi developer
AWare Systems, Imaging expertise for the Delphi developer, Home TIFF and LibTiff Mailing List Archive

LibTiff Mailing List

TIFF and LibTiff Mailing List Archive
August 2005

Previous Thread
Next Thread

Previous by Thread
Next by Thread

Previous by Date
Next by Date

Contact

The TIFF Mailing List Homepage
This list is run by Frank Warmerdam
Archive maintained by AWare Systems



Valid HTML 4.01!



2005.08.05 14:03 "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