8 bit greyscale images look like 4 bit

Tim.Mackey at agso.gov.au Tim.Mackey at agso.gov.au
Tue Nov 28 16:40:27 PST 2000


Hi,

I also had problems with greyscale images appearing to only have a few
(about 4) shades of grey. Other colours (muddy browns and greens) were then
substituted for the other shades of grey.

After delving into the code, it looks like the colour palette is created
when the map file is parsed. Therefore, the 256 colours of the palette are
spread amongst all of the colours defined in the map file (whether these are
active layers or not).

To make my greyscale images appear ok (without brown or green tinges), I
changed the following code in mapfile.c:
I replaced this line:
map->palette.numcolors = 0;

with:
for(int i=0;i<16;i++)
    {
    map->palette.colors[i].red=i*16;
    map->palette.colors[i].green=i*16;
    map->palette.colors[i].blue=i*16;
    }
map->palette.numcolors=16;

This gave my greyscale at least 16 colours to choose from. Not perfect, but
better than previous. Still plenty of palette left for the other colours.

In my application (http://www.agso.gov.au/map/national) I have over 100
layers (1500 classes) in the map file so there is lots of colour
substitution going on.

As a development request, it would be much better if the palette were
constructed from active layers only - Steve?

regards,

Tim Mackey
Web Applications Developer
email: tim.mackey at agso.gov.au
phone: (02) 6249 9813
fax: (02) 6249 9984

Australian Geological Survey Organisation
(Geoscience Australia)
ABN: 80 091 799 039
http://www.agso.gov.au/


-----Original Message-----
From: Scott Phillips [mailto:scott at esrp.org]
Sent: Wednesday, 29 November 2000 10:37
To: mapserver-users at lists.gis.umn.edu
Subject: 8 bit greyscale images look like 4 bit


Hello all,

I am setting up a new server with tiles of 8 bit greyscale images
(landsat 7 panchromatic).   Although the images are 255 color, they
are looking like 16 color images on the screen.  I have tried 
converting them to palleted color (with shades of gray), upgrading
to GD1.8.3, and converting the images from TIFF to EPPL, but I get
the same results.

Are the images being cut down in colors in "mapraster.c" or somewhere.
If so, does anyone know of a workaround to let the images show up in
8 bit color.

Thanks,

Scott Phillips
CSUS/ESRP
sphillip at esrp.org



More information about the MapServer-users mailing list