AWARE [SYSTEMS] Imaging expertise for the Delphi developer
AWare Systems, Imaging expertise for the Delphi developer, Home TIFF and LibTiff Mailing List Archive

LibTiff Mailing List

TIFF and LibTiff Mailing List Archive
October 2005

Previous Thread
Next Thread

Previous by Thread
Next by Thread

Previous by Date
Next by Date

Contact

The TIFF Mailing List Homepage
This list is run by Frank Warmerdam
Archive maintained by AWare Systems



Valid HTML 4.01!



Thread

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

2005.10.31 19:52 "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