- 2004.12.07 11:32 "Re: [Tiff] Fetching pixel data from 4bit tiff", by Joris Van Damme
- 2004.12.07 15:52 "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