2004.12.07 12:25 "[Tiff] Fetching pixel data from 4bit tiff", by Dan Field

2004.12.07 12:21 "Re: [Tiff] Fetching pixel data from 4bit tiff", by Joris Van Damme

Dan,

TIFF Directory at offset 0x8

That certainly is indeed a grayscale TIFF.

Basically I'm trying to take a sample of pixels across the middle of the image, both horizontal and vertical (yes I know the sample algo is wrong for the horizontal.. I've yet to get to that :) )

I'm no C guru myself (Delphi coder instead), but from a quick scan through the code, it seems that the initialization, loop condition, and increment of i in both loops is wrong. Try this instead:

for (i =TheImage.width/2*4;
      i < (TheImage.width*TheImage.height*4);
      i +=TheImage.width*4) {
for (i =TheImage.width*(TheImage.height/2)*4;
      i <TheImage.width*(TheImage.height/2+1)*4;
      i+=4) {

Quite possible I made a mistake myself, though, I'm not a C coder, sorry.

Joris Van Damme
info@awaresystems.be
http://www.awaresystems.be
Download your free TIFF tag viewer for windows here:
http://www.awaresystems.be/imaging/tiff/astifftagviewer.html