2005.10.31 20:11 "Re: [Tiff] TIFFSetField vs TIFFSetField+Private tags", by Mathieu Malaterre
ooops my mail was missing a line:
...
int iCount;
char lng[] = {10, 20, 30, 40 }; // <-
intif = TIFFOpen("bla.tif","w");
...
Thanks for any clue,
Mathieu
Hello there,
I am not sure I understand the private tags thing. What is wrong with
the following code:#define TIFFTAG_PRIVATE 34595
static void TagExtender(TIFF *tiff)
{
static const TIFFFieldInfo xtiffFieldInfo[] = {
{ TIFFTAG_PRIVATE, TIFF_VARIABLE, TIFF_VARIABLE, TIFF_BYTE,
FIELD_CUSTOM, 0, 1, "Private Tag" }
};TIFFMergeFieldInfo( tiff, xtiffFieldInfo,
sizeof(xtiffFieldInfo) / sizeof(xtiffFieldInfo[0]) );
}int main()
{
TIFF *intif;intif = TIFFOpen("bla.tif","w");
TIFFSetTagExtender(TagExtender);TIFFSetDirectory(intif, 0);
char *currentTag = 0;TIFFSetField(intif, TIFFTAG_SOFTWARE, "Foo Bar"); TIFFGetField(intif, TIFFTAG_SOFTWARE, ¤tTag); fprintf( stderr, "Soft tag: %s\n", currentTag ); // ok so far...
iCount = sizeof(lng)/sizeof(lng[0]); TIFFSetField(intif, TIFFTAG_PRIVATE, iCount, lng); //-> returns 0
TIFFWriteDirectory( intif );
TIFFClose(intif);
return 0;
}