[mapserver-users] running out of colors in PC256 output

Lime, Steve D (MNIT) Steve.Lime at state.mn.us
Sat Jan 16 07:29:03 PST 2016


You can create a predefined palette and use that. Here's an example definition:


  OUTPUTFORMAT

    NAME png8

    DRIVER "AGG/PNG"

    MIMETYPE "image/png"

    IMAGEMODE RGB

    EXTENSION "png"

    FORMATOPTION "INTERLACE=OFF"

    FORMATOPTION "PALETTE_FORCE=TRUE"

    FORMATOPTION "PALETTE=/usr/local/mapserver/shared/my.palette" # needs to be a full path

  END


where the palette file is just a text file with a bunch of RGB triplets:


  201,222,252

  40,172,218

  ...

I've used PhotoShop to take sample MapServer 24-bit output that is representative of maps as a whole (shows all feature types and labeling scenarios) and create an 8-bit GIF. That software does a nice job of color reduction but I'm sure there are other ways. Then you can use gdalinfo to extract the palette information. I have a little perl script that parses the gdalinfo output if you're interested.

Steve

________________________________
From: mapserver-users [mapserver-users-bounces at lists.osgeo.org] on behalf of Richard Greenwood [richard.greenwood at gmail.com]
Sent: Friday, January 15, 2016 8:43 PM
To: mapserver
Subject: [mapserver-users] running out of colors in PC256 output

I'm running into more or less the same problem described in this 12 year old ticket:
  https://trac.osgeo.org/mapserver/ticket/397
In my case black truetype font labels will be rendered in dark green or similar when there are a lot of colors in accompanying vector layers with anit-aliasing or opacity. I think the 256 color palette gets used up before the labels are rendered.

I don't want to go to full RGB output because the image sizes are so much larger. If I put a black feature into one of the layers it seems to add it to the palette and then the black labels are render correctly in black. But that seems pretty kludgy.

Any other suggestions?

Thanks

--
Richard W. Greenwood, PLS
www.greenwoodmap.com<http://www.greenwoodmap.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/mapserver-users/attachments/20160116/758ef706/attachment.html>


More information about the mapserver-users mailing list