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
May 2011

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

2011.05.31 10:54 "Write Tile", by Jorge Martin
2011.05.31 12:52 "Re: Write Tile", by Olivier Paquet
2011.05.31 13:02 "Re: Write Tile", by Jorge Martin
2011.05.31 13:02 "Re: Write Tile", by Edward Lam
2011.06.01 10:43 "Re: Write Tile", by Jorge Martin
2011.06.01 13:21 "Re: Write Tile", by Olivier Paquet

2011.05.31 10:54 "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
stripped image" I have set the fields Tilewidth and TileLength and I do not
know what is happening because I did not set any field about the strips. How
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
    TIFFGetField(OutTIFF, TIFFTAG_TILEWIDTH, 128);
    TIFFGetField(OutTIFF, TIFFTAG_TILELENGTH,  128);

    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;



Best Regards,


Jorge