AWARE SYSTEMS
TIFF and LibTiff Mail List Archive

Thread

2003.07.28 23:29 "[Tiff] extended tags", by Percy Tiglao
2003.07.29 01:06 "[Tiff] extended tags", by Chris Cox
2003.07.30 12:24 "[Tiff] extended tags", by Andrey Kiselev
2003.07.31 12:48 "[Tiff] RE: Tiff digest, Vol 1 #5 - 1 msg", by Percy Tiglao
2003.08.03 07:23 "[Tiff] RE: Tiff digest, Vol 1 #5 - 1 msg", by Andrey Kiselev

2003.07.30 12:24 "[Tiff] extended tags", by Andrey Kiselev

I am new to libtiff and I have been trying to use Niles' contrib/tags code to no avail. Does anyone have a sample code that I could use as a reference that adds a private tag of type "TIFF_UNDEFINED" to support a complex data structure in a single private field?

Following code valid for the libtiff 3.6.0 (from CVS or beta release):

#include <tiffio.h>

#define TIFFTAG_MYTAG 666

int main()
{
    TIFF *tiff;

    static const TIFFFieldInfo xtiffFieldInfo[] = {
        { TIFFTAG_MYTAG,    -1,-1, TIFF_ASCII, FIELD_CUSTOM,
          1,       0,      "MyTag" }
    };

    tiff = TIFFOpen("test.tiff", "r+");

    TIFFMergeFieldInfo(tiff, xtiffFieldInfo,
                     sizeof(xtiffFieldInfo) / sizeof(xtiffFieldInfo[0]));
    TIFFSetField(tiff, TIFFTAG_MYTAG, "Tag contents");
    TIFFRewriteDirectory(tiff);

    TIFFClose(tiff);
}

Regards,
Andrey

Andrey V. Kiselev
Home phone: +7 812 5274898 ICQ# 26871517