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
December 2004

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

2004.12.08 02:35 "Q: writing tiled TIFFs", by Chris Losinger
2004.12.08 02:51 "Re: Q: writing tiled TIFFs", by Bob Friesenhahn
2004.12.08 02:55 "Re: Q: writing tiled TIFFs", by Chris Losinger
2004.12.08 02:57 "Re: Q: writing tiled TIFFs", by Bob Friesenhahn
2004.12.08 08:00 "Re: Q: writing tiled TIFFs", by Sachin Garg
2004.12.08 15:56 "Re: Q: writing tiled TIFFs", by Bob Friesenhahn
2004.12.09 07:28 "Re: Q: writing tiled TIFFs", by Sachin Garg
2004.12.08 10:01 "Re: Q: writing tiled TIFFs", by Sachin Garg
2004.12.08 12:41 "Re: Q: writing tiled TIFFs", by Chris Losinger
2004.12.08 12:48 "Re: Q: writing tiled TIFFs", by Joris Van Damme
2004.12.09 02:30 "Re: Q: writing tiled TIFFs", by Chris Losinger
2004.12.09 07:27 "Re: Q: writing tiled TIFFs", by Sachin Garg
2004.12.09 10:12 "Re: Q: writing tiled TIFFs", by Joris Van Damme
2004.12.09 12:48 "Re: Q: writing tiled TIFFs", by Chris Losinger
2004.12.09 13:19 "Re: Q: writing tiled TIFFs", by Joris Van Damme
2004.12.09 13:38 "Re: Q: writing tiled TIFFs", by Chris Losinger
2004.12.09 14:01 "Re: Q: writing tiled TIFFs", by Joris Van Damme
2004.12.09 23:09 "Re: Q: writing tiled TIFFs", by Chris Losinger
2004.12.09 23:29 "Re: Q: writing tiled TIFFs", by Bob Friesenhahn
2004.12.10 06:53 "Re: Q: writing tiled TIFFs", by Sachin Garg
2004.12.10 21:28 "Re: Q: writing tiled TIFFs", by Andrey Kiselev
2004.12.10 21:52 "Re: Q: writing tiled TIFFs", by Bob Friesenhahn
2004.12.10 21:55 "Re: Q: writing tiled TIFFs", by Andrey Kiselev
2004.12.10 21:54 "Re: Q: writing tiled TIFFs", by Chris Losinger
2004.12.10 21:47 "Re: Q: writing tiled TIFFs", by Andrey Kiselev
2004.12.10 21:56 "Re: Q: writing tiled TIFFs", by Bob Friesenhahn
2004.12.10 21:41 "Re: Q: writing tiled TIFFs", by Andrey Kiselev
2004.12.08 13:49 "Re: Q: writing tiled TIFFs", by Sachin Garg
2004.12.08 13:22 "Re: Q: writing tiled TIFFs", by Chris Losinger
2004.12.08 14:05 "Re: Q: writing tiled TIFFs", by Sachin Garg

2004.12.09 13:38 "Re: Q: writing tiled TIFFs", by Chris Losinger

> > 256x256 is apparently the LibTiff default. why does LibTiff choose
> > that for a 200x200 image ? i don't know.
>
> How do you arrive at this 'LibTiff default'?

// set image dims
TIFFSetField(tiff, TIFFTAG_IMAGEWIDTH, (uint32) nWidth);
TIFFSetField(tiff, TIFFTAG_IMAGELENGTH, (uint32) nHeight);

// get default tile size
uint32 tilewidth, tileheight;
tilewidth = 0;
tileheight = 0;
TIFFDefaultTileSize(tiff, &tilewidth, &tileheight);

// use that size
TIFFSetField(tiff, TIFFTAG_TILEWIDTH, tilewidth);
TIFFSetField(tiff, TIFFTAG_TILELENGTH, tileheight);


> I generally decide on the tile size myself, and set TIFFTAG_TILEWIDTH and
> TIFFTAG_TILELENGTH tags before using the actual raster write functions. 
> Are you doing that?

no, because i assumed LibTiff would generate a reasonable default 
tile size, similar to the way it generates reasonable default strip sizes.

> If not, perhaps you should try that and see if it solves your
> problem. If you are doing that, or if it doesn't solve your problem, perhaps you
> could post a code snippet, then maybe we'll be able to see what's going on.

the image i'm using is 8 bits per pixel.

the tile setup part is above. the actual tile writing part looks 
like this:

// need a single tile to hold a copy of the source data
TIFFGetField(pCTIS->tiff, TIFFTAG_TILELENGTH, &th);
TIFFGetField(pCTIS->tiff, TIFFTAG_TILEWIDTH, &tw);


ISByteArray tempTile;
tempTile.SetSize(TIFFTileSize(pCTIS->tiff));
if (tempTile.GetPtr() == NULL)
{
  return IS_ERR_MEM;
}

for (UINT32 y = 0; y < nHeight; y+=th)
{
  for (UINT32 x = 0; x < nWidth; x+=tw)
  {
    // copy a square part of the source image (or as much of it as we can)
    // to the tile buffer.
    CISOverlay io;
    io.OverlayImage(tempTile, tw, th,     // output
          pImg, nWidth, nHeight,          // input (250x200, in this case)
          -x, -y,                         // position the source image 'over' the tile buffer
          1.0, pCTIS->bitDepth / 8,
          TIFFTileRowSize(pCTIS->tiff),   // number of bytes in tile buffer row
          rowStride,                      // number of bytes in source image row
          0);
    if (TIFFWriteTile(pCTIS->tiff, tempTile.GetPtr(), x, y, 0, 0) == -1)
    {
      m_error=IS_ERR_FILEWRITE;
      return FALSE;
    }
  }
}



----
Chris Losinger
losinger@earthlink.net
smallest@smalleranimals.com          http://www.smalleranimals.com