AWARE SYSTEMS
TIFF and LibTiff Mail List Archive

Thread

2004.12.07 12:25 "[Tiff] Fetching pixel data from 4bit tiff", by Dan Field
2004.12.07 11:32 "Re: [Tiff] Fetching pixel data from 4bit tiff", by Joris
2004.12.07 12:38 "Re: [Tiff] Fetching pixel data from 4bit tiff", by Dan Field
2004.12.07 11:48 "Re: [Tiff] Fetching pixel data from 4bit tiff", by Joris
2004.12.07 12:57 "Re: [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
2004.12.07 13:02 "Re: [Tiff] Fetching pixel data from 4bit tiff", by Joris
2004.12.07 15:50 "Re: [Tiff] Fetching pixel data from 4bit tiff", by Dan Field
2004.12.07 15:52 "Re: [Tiff] Fetching pixel data from 4bit tiff", by Bob Friesenhahn
2004.12.07 17:46 "Re: [Tiff] Fetching pixel data from 4bit tiff", by Dan Field
2004.12.07 17:04 "Re: [Tiff] Fetching pixel data from 4bit tiff", by Bob Friesenhahn
2004.12.07 20:00 "Re: [Tiff] Fetching pixel data from 4bit tiff", by Joris
2004.12.07 20:41 "Re: [Tiff] Fetching pixel data from 4bit tiff", by Bob Friesenhahn

2004.12.07 15:50 "Re: [Tiff] Fetching pixel data from 4bit tiff", by Dan Field

                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);

This is no different to what I have.

--
Dan Field <dof@llgc.org.uk> http://www.cymruarywe.org/
                                       http://www.walesontheweb.org/
     Developer / Sysadmin
     Llyfyrgell Genedlaethol Cymru