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

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

                R=(unsigned char)TIFFGetR(raster+i);
                G=(unsigned char)TIFFGetG(raster+i);
                B=(unsigned char)TIFFGetB(raster+i);
                A=(unsigned char)TIFFGetA(raster+i);

There's another error here, sorry I didn't spot that one earlier. TIFFGetR and the like don't take an address of a 32bit RGBA value, but the RGBA value itself. So you should actually be doing

uint32 rgba;
rgba=*(uint32*)(raster+i);  // or something along these lines, C invokes instant dyslexia over here
R=(unsigned char)TIFFGetR(rgba);
G=(unsigned char)TIFFGetG(rgba);
B=(unsigned char)TIFFGetB(rgba);
A=(unsigned char)TIFFGetA(rgba);

Joris Van Damme
Download your free TIFF tag viewer for windows here: