2002.01.02 13:09 "Re: Partial Extraction of a Scanline?", by Thomas Deweese
Thanks Peter for responding to my previous mail!
Take for example, I would like to view a part of a striped image with scanline size = 32,000 pixels on a screen 1024 by 768.
Using ReadScanline will return me all 32,000pixels when in fact only 1024 pixels can be seen on screen. The other 30,000+ pixels are rather useless. I was thinking won't it be better if I can just get that 1024 pixels instead of the whole scanline? How should I go about modifying the code to read partial scanline? Please enlighten me!
I don't think you want to modify libtiff for this purpose. The right answer is to write the images as tiled tiffs. In fact there is a good chance that they already are tiled tiffs (as I believe most GeoTiff images are). Then you will need to move from the readScanline functions to the readTile methods in Tiff. If you are using the read*RGBA functions you may have some significant extra work to get the equivalent result out of the the tile methods.
If you are wondering why you should use tiles instead of scanlines, just consider if the tiff is compressed in any way (JPEG, LZW, packBits, etc). You would still need to read and decompress all 32K pixels, since all the compression algs require that all the data up to the point you want to read be decompressed. Since tiles are compressed independent of one another you just decompress full tiles.
If your response is that your images are never compressed then while reading partial scan lines is feasible in this case you are really talking about a very application specific "hack".
I'll get off the soap box now, and I hope this helps...
Editor's note: This mail was not originally archived, and has been reconstructed from quotes.