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
August 2007

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

2007.08.17 14:51 "tiff problems win to mac", by Balint Radics
2007.08.17 15:27 "Re: tiff problems win to mac", by Bob Friesenhahn
2007.08.17 15:32 "Re: tiff problems win to mac", by Balint Radics
2007.08.17 15:45 "Re: tiff problems win to mac", by Bob Friesenhahn
2007.08.17 19:25 "Re: tiff problems win to mac", by Balint Radics
2007.08.17 20:05 "Re: tiff problems win to mac", by Bob Friesenhahn

2007.08.17 19:25 "Re: 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


On Fri, 17 Aug 2007, Bob Friesenhahn wrote:

> On Fri, 17 Aug 2007, Balint Radics wrote:
> > 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.
>
> Bob
> ======================================
> Bob Friesenhahn
> bfriesen@simple.dallas.tx.us, http://www.simplesystems.org/users/bfriesen/
> GraphicsMagick Maintainer,    http://www.GraphicsMagick.org/
>