2005.12.07 14:17 "[Tiff] Read TIFF at specific point with specific dimensions", by Manuel D. Lago Reguera

2005.12.08 09:22 "Re: [Tiff] Read TIFF at specific point with specific dimensions", by Andrey Kiselev


On Wed, Dec 07, 2005 at 03:17:05PM +0100, Manuel D. Lago Reguera wrote:

Hello, I am new in this and I would like to know if exists some function to read a fragment of a TIFF in the way read(x, y, w, h). I've to work with big images (minimun 300MB) and it's too expensive to have all the image loaded in memory.

With a function read(x, y, w, h) I could work with the block of interest.

There is no such a function in libtiff. But you don't need to read the whole image into memory to process it, TIFF image tipically stored in data chunks (strips or tiles), so you should read one chunk per time. TIFFComputeStrip() and TIFFComputeTile() functions return strip/tile number for specified coordinates and you should use that number in TIFFReadEncodedStrip()/TIFFReadTile() functions respectively.

Probably you may find GDAL library (http://www.gdal.org) useful for your task. GDAL has flexible API which is one level higher than libtiff API. With GDAL you can get access to pixels without bothering with actual data layout.

Best regards,

Andrey V. Kiselev

Home phone: +7 812 5970603 ICQ# 26871517