2012.09.25 15:41 "[Tiff] Error writing multi-page TIFF", by Jorge Martin

Hello,

I get the following error message when calling TIFFWriteDirectory for a multi-page generation: "TIFFLinkDirectory: Error fetching directory count. ". This error appears when TIFFWriteDirectory is used to write the second image. I have never seen this type of error generating multi-page TIFF files

Please find below a brief fragment of my code:

   NumSubImage = 4;

   TIFF * m_TIFFptr = XTIFFOpen(FileName, "w");

   for(int i = 0; i < NumSubImage ; i++)
   {

    // Function that writes the TAGs
    WriteTags(TIFF_ptr);

    // Function that writes the tiff values
    WriteTiff(TIFF_ptr);

      // Check to not call TIFFWriteDirectory in last page
     if( ( i + 1 ) < NumSubImage )
     {
          if( TIFFWriteDirectory(TIFF_ptr ) == 0)
          {
               cout<<"Error in TIFFWriteDirectory" <<endl;
          }
      }

    }

Best Regards,

Jorge