AWARE SYSTEMS
TIFF and LibTiff Mail List Archive

Thread

2007.11.02 20:26 "[Tiff] Recent bug fixes in CVS head", by Frank Warmerdam
2007.11.21 18:52 "[Tiff] tag content size limit?", by Frank Warmerdam
2007.11.22 08:05 "RE: [Tiff] tag content size limit?", by Tillaart, Rob van den
2008.01.14 12:02 "回复: RE: [Tiff] TIFFWriteScanline - wr ite band orders", by gis geo
2008.01.14 06:32 "[Tiff] TIFFWriteScanline - write band orders", by gis geo
2008.01.14 07:25 "RE: [Tiff] TIFFWriteScanline - write band orders", by Tillaart, Rob van den
2007.12.30 22:20 "[Tiff] libtiff4 - tests failing - TIFF_SETGET_UNDEFINED for some tags", by Frank Warmerdam
2007.12.30 23:07 "Re: [Tiff] libtiff4 - tests failing - TIFF_SETGET_UNDEFINED for some tags", by Frank Warmerdam
2007.12.30 23:59 "Re: [Tiff] libtiff4 - tests failing - TIFF_SETGET_UNDEFINED for some tags", by Bob Friesenhahn

2008.01.14 06:32 "[Tiff] TIFFWriteScanline - write band orders", by gis geo

Hi All,

   I am learning and testing TIFF Lib, and have experienced the following    problem:

   I wish to write a 16-bit RGB imagery with separate planes, using the    following codes

 ...
   TIFFSetField(out, TIFFTAG_IMAGEWIDTH, width);
TIFFSetField(out, TIFFTAG_IMAGELENGTH, height);
   TIFFSetField(out, TIFFTAG_BITSPERSAMPLE, 16);
TIFFSetField(out, TIFFTAG_SAMPLESPERPIXEL, 3);
TIFFSetField(out, TIFFTAG_PLANARCONFIG, 2);

  TIFFSetField(out, TIFFTAG_PHOTOMETRIC,    2);
  TIFFSetField(out, TIFFTAG_COMPRESSION,    COMPRESSION_NONE);

     TIFFSetField(out, TIFFTAG_ROWSPERSTRIP,    TIFFDefaultStripSize(out, 1));

 for (j = 0; j < height; j++)
   {
 ...

       TIFFWriteScanline(out, buf_r, j,    0);

    TIFFWriteScanline(out, buf_g, j,    1);
    TIFFWriteScanline(out, buf_b, j,    2);

}

The output is fine and works. I can verify that.

   But, after I have applied a 3*3 filter analysis, and I wish to output the    same row-by-row data in this form, and the output tiff file is wrong:

   for (j = 1; j < height-1; j++)
{
 ...

   if (j ==1    )
   {

    TIFFWriteScanline(out, buf_r,    j-1, 0);
    TIFFWriteScanline(out, buf_g, j-1,    1);
    TIFFWriteScanline(out, buf_b, j-1,    2);

}

       TIFFWriteScanline(out, buf_r, j,    0);

    TIFFWriteScanline(out, buf_g, j,    1);
    TIFFWriteScanline(out, buf_b, j,    2);

if (j ==height-2 )
{

    TIFFWriteScanline(out, buf_r,    j+1, 0);
    TIFFWriteScanline(out, buf_g, j+1,    1);
    TIFFWriteScanline(out, buf_b, j+1,    2);

}
  }

   I could not figure out why. This might to related to TIFFWriteScanline()    and some expectation from the Tiff Lib that I did not specify.

THANK you in advance.

---------------------------------
   雅虎邮箱传递新年祝福,个性贺卡送亲朋!