Received: from mailgate001.isp.belgacom.be (mailgate001.isp.belgacom.be [195.238.6.86])
	by maildelivery022.isp.belgacom.be (Postfix) with ESMTP id E9F731A4041
	for <joris.at.lebbeke@skynet.be>; Fri, 17 Aug 2007 17:17:33 +0200 (CEST)
Received: from r153.dmsolutions.ca (HELO duke.maptools.org) ([209.217.116.153])
  by in.mx.skynet.be with ESMTP; 17 Aug 2007 17:17:33 +0200
Received: from duke.maptools.org (duke.maptools.org [127.0.0.1])
	by duke.maptools.org (8.12.11/8.12.10) with ESMTP id l7HEpoNO008365;
	Fri, 17 Aug 2007 10:53:23 -0400
Received: from atlasc01.physik.uni-bonn.de (atlasc01.physik.uni-bonn.de
	[131.220.165.44])
	by duke.maptools.org (8.12.11/8.12.10) with ESMTP id l7HEpmiG008362
	for <tiff@lists.maptools.org>; Fri, 17 Aug 2007 10:51:48 -0400
Received: from radics (helo=localhost)
	by atlasc01.physik.uni-bonn.de with local-esmtp (Exim 4.63)
	(envelope-from <radics@physik.uni-bonn.de>) id 1IM3Ax-0002zf-B6
	for tiff@lists.maptools.org; Fri, 17 Aug 2007 16:51:47 +0200
Date: Fri, 17 Aug 2007 16:51:47 +0200 (CEST)
From: Balint Radics <radics@physik.uni-bonn.de>
To: tiff@lists.maptools.org
Message-ID: <Pine.LNX.4.44.0708171644040.31036-100000@atlasc01.physik.uni-bonn.de>
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII
Subject: [Tiff] tiff problems win to mac 
X-BeenThere: tiff@lists.maptools.org
X-Mailman-Version: 2.1.4
Precedence: list
List-Id: TIFF and libtiff discussion <tiff.lists.maptools.org>
List-Unsubscribe: <http://lists.maptools.org/mailman/listinfo/tiff>,
	<mailto:tiff-request@lists.maptools.org?subject=unsubscribe>
List-Archive: <http://lists.maptools.org/mailman/private/tiff>
List-Post: <mailto:tiff@lists.maptools.org>
List-Help: <mailto:tiff-request@lists.maptools.org?subject=help>
List-Subscribe: <http://lists.maptools.org/mailman/listinfo/tiff>,
	<mailto:tiff-request@lists.maptools.org?subject=subscribe>
Sender: tiff-bounces@lists.maptools.org
Errors-To: tiff-bounces@lists.maptools.org
X-UIDL: 000000000023ceae.00002727
X-MSP-STORE: Fri, 17 Aug 2007 17:17:34 +0200
Status: RO


Dear experts,

I had a working code (32 windows, libtiff 3.7.3) reading Tiff files. I
wanted to use exactly the same on a 64 bit Mac OS X 10.4.10 (cpu powerpc
970) but I get the strange behaviour that while on the windows libtiff
found the pixel values to be 16 bit per sample, on the Mac OS X it sees
them to be 1048576 bits. I don't understand what is going on, please help!

Here is the result of tiffinfo on my tiff files:

TIFF Directory at offset 0x8 (8)
  Subfile Type: (0 = 0x0)
  Image Width: 1242 Image Length: 1152
  Resolution: 72, 72 pixels/inch
  Bits/Sample: 16
  Sample Format: unsigned integer
  Compression Scheme: None
  Photometric Interpretation: min-is-black
  Smaples/Pixel: 1
  Rows/Strip: 1152
  Planar Configuration: single image plane

I attached the minimal c++ code that works on 32 windows but doesn't work
on 64 bit Mac OS X. Maybe I have to use additional flags when compiling
under Mac. I have gcc 4.0.1 (powerpc-apple-darwin8-gcc-4.0.1).

#include <tiffio.h>
#include <iostream>

int main(int argc, char * argv[]){

  TIFF *Tif;
  int bitspersample;
  int bytespersample;
  int ImageHeight;
  int ImageWidth;
  int tmpw;
  int tmph;
  int out;

  Tif = TIFFOpen(argv[1], "r");

  if (TIFFGetField(Tif, TIFFTAG_IMAGELENGTH, &ImageHeight) == 0 ||
      TIFFGetField(Tif, TIFFTAG_IMAGEWIDTH, &ImageWidth) == 0 ||
      TIFFGetField(Tif, TIFFTAG_BITSPERSAMPLE, &bitspersample) == 0 ){
    std::cerr << "error reading some properities of image " << argv[1] <<
std::endl;
    exit(-1);
  }

  std::cerr << "***Bitspersample: " << bitspersample << std::endl;
  std::cerr << "***ImageWidth: " << ImageWidth << std::endl;
  std::cerr << "***Image: " << ImageHeight << std::endl;
  bytespersample = bitspersample/8;

  /*  unsigned char * buf;
  buf = new unsigned char[TIFFScanlineSize(Tif)];

  for (int rows = 0; rows < ImageHeight; rows++){
    TIFFReadScanline(Tif, buf, rows);
    for (int cols = 0; cols < ImageWidth; cols++){
      out = 0;
      for (int kk = bytespersample; kk > 0; kk--) {
        out <<= 8;
        out += buf[cols*bytespersample+kk-1]; //here is the pixel value
      }
    }
  }

  delete [] buf;*/

  TIFFClose(Tif);

}




Please, help!

Thank you,
Balint





_______________________________________________
Tiff mailing list: Tiff@lists.maptools.org
http://lists.maptools.org/mailman/listinfo/tiff
http://www.remotesensing.org/libtiff/
