2005.12.30 08:20 "Re: [Tiff] [ANNOUNCE]: Libtiff 3.8.0 released", by Andrey Kiselev

2005.12.29 23:55 "[Tiff] [ANNOUNCE]: Libtiff 3.7.3 released", by Andrey Kiselev

Hello, folks,

The new version of the libtiff package has been released. You can grab sources from the our FTP site:

 ftp://ftp.remotesensing.org/libtiff/tiff-3.8.0.tar.gz
 ftp://ftp.remotesensing.org/libtiff/tiff-3.8.0.zip

Release notes are here:

 http://www.remotesensing.org/libtiff/v3.8.0.html

The most important feature of the new release is a custom directory support. This support is a bit limited for now (jus because of my time constraints, but I am working on the full support for the custom directories, it will be available very shortly with the next libtiff release). For now read only support for custom directories should be fully functional. You should read above as "read-only EXIF support has been added to libtiff".

There is no documentation on new functionality (again, I am working on it and it will be added in the next release), but the sample code has been attached to this message.

I am very sorry that I can't write any additional comments to that peace of code, so those, who do not understand how it works should wait for the next release, it will be issued really shortly.

What is works for now: arbitrary custom directory reading should work, you just should implement the TIFFFieldInfo array with the directory structure and call the TIFFReadCustomDirectory() function. Note, that TIFFReadCustomDirectory() can get any TIFFFieldInfo array, with any tag numbering and this is the way to use separate tag namespace. For EXIF directory there is hardcoded tag array and a special function TIFFReadEXIFDirectory().

Sample image pack has been updated too:

ftp://ftp.remotesensing.org/pub/libtiff/pics-3.8.0.tar.gz

Happy New Year!

Andrey

--
Andrey V. Kiselev
ICQ# 26871517

#include <tiffio.h>
#include <stdio.h>

#define MYTAG_EXIFVERSION 36864

static const TIFFFieldInfo
myFieldInfo[] = {
   { MYTAG_EXIFVERSION, 4, 4, TIFF_UNDEFINED, FIELD_CUSTOM,
      1, 0, "ExifVersion" }
};

int
main(int argc, char **argv)
{

    TIFF    *tiff;
    char    szVersion[5];
    long    iOffset;

    tiff = TIFFOpen(argv[1], "r");

    if (!TIFFGetField(tiff, TIFFTAG_EXIFIFD, &iOffset))
        return 1;

    TIFFReadCustomDirectory(tiff, iOffset, myFieldInfo,
                            sizeof(myFieldInfo)/sizeof(myFieldInfo[0]));

    if (TIFFGetField(tiff, MYTAG_EXIFVERSION, szVersion)) {
        szVersion[4] = '\0';
        printf("EXIF version is: %.2x%.2x%.2x%.2x\n",
               szVersion[0], szVersion[1], szVersion[2], szVersion[3]);
    }

    TIFFClose(tiff);
    return 0;
}