2003.10.31 22:40 "[Tiff] col_offset in TIFFRGBAGetImage", by Mark Tigges

2003.11.01 00:09 "[Tiff] col_offset in TIFFRGBAGetImage", by Mark Tigges

I'm experimenting with the TIFFRGBAImageGet function (and it's relatives). Particularly I wish to use it to get a subset of a tiff.

This seemed to be working. I'm working on very large images, the results seemed right, so I assumed they were. Unfortunately they weren't. It seems that the col_offset is pretty much ignored. No matter what I ask for, I only get data starting at the 0th column. The documentation of the state structure is kind of sparse. Can anybody fill in the gaps in my understanding?

I worked out the problem. Turns out there is a bug in tif_getimage.c (3.6.7).

The problem is in the gtStripContig function when it computes pos.

pos must also be incremented by the col_offset*sizeof_pixel.

I presumed that sizeof_pixel should be img->bitspersample*img->samplesperpixel, but it only works as img->samplesperpixel.

There may be other issues that I haven't realized.