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