2007.07.11 00:04 "[Tiff] BigTIFF, let the race begin!", by Bob Friesenhahn

2007.08.17 19:25 "Re: [Tiff] tiff problems win to mac", by Balint Radics

Hi,

the problem has been solved. First of all I used a wrong type for the size of the bits (int, although it must have been unsigned short int), but still interestingly it worked under windows and linux fine.

The major issure is that it seems one should not assume a specific byte order because libtiff will always put the data in the byte order that is specific to the platform one uses. I've assumed a byte order and wanted to use the same on both windows intel and Mac OS X and so it didn't work.

I used this method on windows:

  unsigned short * buf;
  buf = new unsigned short[TIFFScanlineSize(Tif)];
  int out;
  for(int rows = 0; rows < ImageHeight; rows++){
     TIFFReadScanline(Tif, buf, rows);
        for(int cols = 0; cols < ImageWidth; cols+){
          out = 0;
          for(int k = bytespersample; k > 0; k--){
             out <<=8;
             out +=buf[cols*bytespersample+kk-1];
          }
        }
  }

Although I should've used this method, which has not assumed any byte order:

  unsigned short * buf;
  buf = new unsigned short[TIFFScanlineSize(Tif)];
  int out;
  for(int rows = 0; rows < ImageHeight; rows++){
     TIFFReadScanline(Tif, buf, rows);
        for(int cols = 0; cols < ImageWidth; cols+){
          out = buf[cols];
        }
  }

Well, at least it works now.

Balint

Thanx!

Do you know which version does not have this bug? I think I had tried one of the latest ones and that had the bug. Did you also experience this bug under Mac OS X? Because the same code with the same libtiff version runs on my windows, it only produces this behaviour under mac.

I am using version 3.8.0 on my PowerPC/G5 Mac, and 3.9.0beta on my Solaris SPARC system (also big-endian). Some of the libtiff versions between those two versions also have directory reading bugs.