AWARE SYSTEMS
TIFF and LibTiff Mail List Archive

Thread

2011.04.12 02:06 "[Tiff] Libtiff v4.0.0beta7 released", by Bob Friesenhahn
[...]
2011.06.01 10:43 "Re: [Tiff] Write Tile", by Jorge Martin
2011.05.31 10:54 "[Tiff] Write Tile", by Jorge Martin
2011.05.31 12:52 "Re: [Tiff] Write Tile", by Olivier Paquet
2011.05.31 13:02 "Re: [Tiff] Write Tile", by Edward Lam
2011.06.01 13:21 "Re: [Tiff] Write Tile", by Olivier Paquet
[...]

2011.05.31 10:54 "[Tiff] Write Tile", by Jorge Martin

Hello,

I am trying to write a tiled TIFF file but the

function TIFFWriteTile is always returning "Can not write tiles to a image" I have set the fields Tilewidth and TileLength and I do stripped

not know what is happening because I did not set any field about the How strips.

can I solve this issue? I pasted some code that I used to write the TIFF:

 TIFF * TIFFDst = TIFFOpen(pszDstFileName, "w");

//Store the differen TAG info from the TIFF input file TIFFSetField(OutTIFF, TIFFTAG_IMAGELENGTH, 3559);

    TIFFSetField(OutTIFF, TIFFTAG_IMAGEWIDTH, 701);
    TIFFSetField(OutTIFF, TIFFTAG_BITSPERSAMPLE, 8);
    TIFFSetField(OutTIFF, TIFFTAG_SAMPLESPERPIXEL, 1);
    TIFFSetField(OutTIFF, TIFFTAG_PHOTOMETRIC, 1);
    TIFFSetField(OutTIFF, TIFFTAG_RESOLUTIONUNIT,RESUNIT_CENTIMETER);
    TIFFSetField(OutTIFF, TIFFTAG_COMPRESSION, COMPRESSION_NONE);
    TIFFSetField(OutTIFF, TIFFTAG_THRESHHOLDING, THRESHHOLD_BILEVEL);
    TIFFSetField(OutTIFF, TIFFTAG_IMAGEDESCRIPTION, "L1A_PAN");
    TIFFSetField(OutTIFF, TIFFTAG_ORIENTATION, ORIENTATION_TOPLEFT);
    TIFFSetField(OutTIFF, TIFFTAG_XRESOLUTION, 1);
    TIFFSetField(OutTIFF, TIFFTAG_YRESOLUTION, 1);
    TIFFSetField(OutTIFF, TIFFTAG_PLANARCONFIG, 1);
    TIFFSetField(OutTIFF, TIFFTAG_DATETIME, "2011:05:18 14:15:15");

      //TILES INFO

    TIFFSetField(OutTIFF, TIFFTAG_XPOSITION, 1);
    TIFFSetField(OutTIFF, TIFFTAG_YPOSITION, 1);
    TIFFSetField(OutTIFF, TIFFTAG_SAMPLEFORMAT, SAMPLEFORMAT_UINT);

int index =0;

for ( y = 0; y < ImageLength; y += TileLength )
{
    for (x = 0; x < ImageWidth; x += TileWidth )
    {

      //Loop to write the matrix data into a buffer.
      index =0;
      for (int i = y; i < y+TileLength; i++)
      {
          for (int j = x; j < x+TileWidth; j++)
          {

               //get the data from the matrix

                          buffer[index] =

(uint8)(*m_TIFFImage.m_ImagMatrix[0].Values).coeff(i,j);

                            index++;

                   }


               }

     TIFFWriteTile(TIFFDst, (tdata_t)buffer, x, y, 0, 0);

      }

  }

TIFFClose(TIFFDst);
TIFFDst = NULL;

Jorge