AWARE SYSTEMS
TIFF and LibTiff Mail List Archive

Thread

2005.10.31 19:52 "[Tiff] TIFFSetField vs TIFFSetField+Private tags", by Mathieu Malaterre
2005.10.31 20:11 "Re: [Tiff] TIFFSetField vs TIFFSetField+Private tags", by Mathieu Malaterre

2005.10.31 19:52 "[Tiff] TIFFSetField vs TIFFSetField+Private tags", by Mathieu Malaterre

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;

int iCount;

intif = TIFFOpen("bla.tif","w");
TIFFSetTagExtender(TagExtender);

TIFFSetDirectory(intif, 0);
char *currentTag = 0;

TIFFSetField(intif, TIFFTAG_SOFTWARE, "Foo Bar"); TIFFGetField(intif, TIFFTAG_SOFTWARE, &currentTag); 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;
}

Thanks
Mathieu