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

LibTiff Mailing List

TIFF and LibTiff Mailing List Archive
June 2005

Previous Thread
Next Thread

Previous by Thread
Next by Thread

Previous by Date
Next by Date

Contact

The TIFF Mailing List Homepage
Archive maintained by AWare Systems



New Datamatrix section



Valid HTML 4.01!



Thread

2005.06.28 09:09 "Simpler interface than strip-oriented interface", by Katrina Maramba
2005.06.28 14:20 "Re: Simpler interface than strip-oriented interface", by Bob Friesenhahn

2005.06.28 14:20 "Re: Simpler interface than strip-oriented interface", by Bob Friesenhahn

On Tue, 28 Jun 2005, katrina maramba wrote:
>
> I am currently coding an interface to Libtiff which would convert a 
> strip of the tiff image to RGB format.  I am using the 
> TIFFReadRGBAStrip API.  This works perfectly fine until I find 
> images with only 1 strip and very, very large stripbytecounts (like 
> 4mb or 6mb).  I would then have to keep a buffer with this size (4 
> or 6 mb)since the API needs the whole strip to be passed to it. 
> This is very hard for me since we only have a limited amount of 
> memory.
>
> Is there another way to parse the image??  Im looking for an 
> interface that would accept a smaller data size than the strip, if 
> the strip is too large.

Use TIFFReadScanline().  This returns a single scanline from the 
strip.  Conversion from strips to scanlines is done within libtiff in 
order to produce scanlines while using a small amount of memory.

This is a much lower-level interface than TIFFReadRGBAStrip() so you 
have to be prepared to unpack packed pixels and be aware of endian 
ordering (libtiff presents data for sample sizes evenly divisible by 8 
in native endian order).

> I also found out about ScanLine but this is not a very reliable 
> interface since it only works if the RowsPerStrip is equal to 1 and 
> if there is no compression.  My understanding is correct, am I 
> right?

TIFFReadScanline() works fine for me.  For reasonable sized strips, 
using TIFFReadEncodedStrip() may be faster.  TIFFReadEncodedStrip() is 
even lower level than TIFFReadEncodedStrip(), but it is high enough 
that the data is uncompressed.

Bob
======================================
Bob Friesenhahn
bfriesen@simple.dallas.tx.us, http://www.simplesystems.org/users/bfriesen/
GraphicsMagick Maintainer,    http://www.GraphicsMagick.org/