AWARE [SYSTEMS]
AWare Systems, , Home TIFF and LibTiff Mailing List Archive

LibTiff Mailing List

TIFF and LibTiff Mailing List Archive
August 2010

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



New Datamatrix section



Valid HTML 4.01!



Thread

2010.08.20 08:16 "TIFFWriteScanline works on Windows and Linux but fails on Mac", by <molholm@gmail.com>
2010.08.22 02:26 "Re: TIFFWriteScanline works on Windows and Linux but fails on Mac", by Scott Ribe
2010.08.23 07:04 "Re: TIFFWriteScanline works on Windows and Linux but fails on Mac", by <molholm@gmail.com>
2010.08.23 07:40 "Re: TIFFWriteScanline works on Windows and Linux but fails on Mac", by <jcupitt@gmail.com>
2010.08.23 08:04 "Re: TIFFWriteScanline works on Windows and Linux but fails on Mac", by <molholm@gmail.com>
2010.08.23 08:18 "Re: TIFFWriteScanline works on Windows and Linux but fails on Mac", by <molholm@gmail.com>
2010.08.23 10:47 "Re: TIFFWriteScanline works on Windows and Linux but fails on Mac", by <jcupitt@gmail.com>
2010.08.23 10:18 "Re: TIFFWriteScanline works on Windows and Linux but fails on Mac", by <molholm@gmail.com>
2010.08.23 12:02 "Re: TIFFWriteScanline works on Windows and Linux but fails on Mac", by Juergen Buchmueller
2010.08.23 13:25 "Re: TIFFWriteScanline works on Windows and Linux but fails on Mac", by <molholm@gmail.com>
2010.08.23 14:17 "Re: TIFFWriteScanline works on Windows and Linux but fails on Mac", by <molholm@gmail.com>
2010.08.23 14:38 "Re: TIFFWriteScanline works on Windows and Linux but fails on Mac", by Olivier Paquet
2010.08.24 12:31 "Re: TIFFWriteScanline works on Windows and Linux but fails on Mac", by <molholm@gmail.com>

2010.08.20 08:16 "TIFFWriteScanline works on Windows and Linux but fails on Mac", by <molholm@gmail.com>

I use libtiff3.9.4 for reading and writing TIFF files in c++ on mac
10.6.4. My project is written to be portable and runs without any
issues on both Windows 32-bit og Ubuntu 64-bit. But on the mac the
Libtiff function TIFFWriteScanline always fails (it returns != 1). The
TIFF file is created, but it does not have any contents. I'am able to
read the LZW compressed images but i'm not able to write it.
Furthermore the program also works for CCITT Group4 images on windows
and linux, but read scanline fails on the mac.

I have tried both libtiff3.8.2 and libtiff4.0.0beta6 without any luck.

Any ideas why libtiff won't write scanlines on the mac when it works
fine on linux?

Code:

// set baseline tags
TIFFSetField(tiffImage, TIFFTAG_IMAGEWIDTH, 7368);
TIFFSetField(tiffImage, TIFFTAG_IMAGELENGTH, 4757);
TIFFSetField(tiffImage, TIFFTAG_BITSPERSAMPLE, 8);
TIFFSetField(tiffImage, TIFFTAG_SAMPLESPERPIXEL, 1);
TIFFSetField(tiffImage, TIFFTAG_ORIENTATION, ORIENTATION_TOPLEFT);
TIFFSetField(tiffImage, TIFFTAG_COMPRESSION, COMPRESSION_LZW);
TIFFSetField(tiffImage, TIFFTAG_PHOTOMETRIC, PHOTOMETRIC_MINISBLACK);
TIFFSetField(tiffImage, TIFFTAG_THRESHHOLDING, 1);
TIFFSetField(tiffImage, TIFFTAG_XRESOLUTION, 400;
TIFFSetField(tiffImage, TIFFTAG_YRESOLUTION, 400);
TIFFSetField(tiffImage, TIFFTAG_RESOLUTIONUNIT, 2);

uint32	rowsPerStrip;
rowsPerStrip = tiffData->height;
rowsPerStrip = TIFFDefaultStripSize(tiffImage, rowsPerStrip);
TIFFSetField(tiffImage, TIFFTAG_ROWSPERSTRIP, rowsPerStrip);
TIFFSetupStrips(tiffImage);

// row buffer
scanlineSize = TIFFScanlineSize(tiffImage);
scanline = (unsigned char*) _TIFFmalloc(scanlineSize);

// write image
for (int i = 0; i < iplImage->height; i++)
{
   memcpy(scanline, iplImage->imageData + iplImage->widthStep*i, scanlineSize);
   if(TIFFWriteScanline(tiffImage, scanline, i, 0) != 1){
      //Error
   }
}

// clean up
_TIFFfree(scanline);

Regards,
Dennis