AWARE SYSTEMS
TIFF and LibTiff Mail List Archive

Thread

2003.03.31 15:31 "color map question", by Carter John-jcarte01
2003.04.02 09:48 "RE: color map question", by Carter John-jcarte01

2003.03.31 15:31 "color map question", by Carter John-jcarte01

Hi
in the code below is taken from a section dealing with reading in a 4bit colour
tiff image.
I read the strip in from a file (LZW decompress if necessary).
I then use the upper and lower 4bits as an index into the colour map table
However the location of colours in the colour map doesn't seem to tally
with the colours in the original tiff image.
is there something I'm missing?

thanks jc

    if(tiff_data->colour_map.location){
     pixel =
      colour_map[(U1)(strip.location[bytes_counted]&(0x0F0>>4))];
     pixel_list->location[pixels_filled].blue=pixel.red/256;
     pixel_list->location[pixels_filled].green =pixel.green/256;
     pixel_list->location[pixels_filled].red =pixel.blue/256;
     if(!((pixels_filled + 1) % tiff_data->image_width))
      if(tiff_data->image_width % 2)
       continue;
     ++pixels_filled;
     pixel =
       colour_map[(U1)(strip.location[bytes_counted]&(0x0F))];
     pixel_list->location[pixels_filled].blue=pixel.red/256;
     pixel_list->location[pixels_filled].green=pixel.green/256;
     pixel_list->location[pixels_filled].red=pixel.blue/256;
    }else{

____________________________

John Carter
BSS O&M Development group,
Motorola,
Mahon Industrial Estate,
Cork.

Tel:         +353 21 4807 637 (direct)
Fax:         +353 21 4357635  ( reception )

Mobile: +353 86 3947920
Email <mailto:john.a.carter@motorola.com> www <http://www.cork.cig.mot.com/~jcarte01/> <?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Homer: There's 3 ways to do things, the right way, the wrong way, and the max power way.
Bart: isn't that the wrong way.
Homer: yea but faster.