<html dir="ltr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" id="owaParaStyle"></style>
</head>
<body fpstyle="1" ocsi="0">
<div style="direction: ltr;font-family: Tahoma;color: #000000;font-size: 10pt;">
<div>You can create a predefined palette and use that. Here's an example definition:</div>
<div><br>
</div>
<div>
<p class="p1">  OUTPUTFORMAT</p>
<p class="p1">    NAME png8</p>
<p class="p1">    DRIVER "AGG/PNG"</p>
<p class="p1">    MIMETYPE "image/png"</p>
<p class="p1">    IMAGEMODE RGB</p>
<p class="p1">    EXTENSION "png"</p>
<p class="p1">    FORMATOPTION "INTERLACE=OFF"</p>
<p class="p1">    FORMATOPTION "PALETTE_FORCE=TRUE"</p>
<p class="p1">    FORMATOPTION "PALETTE=/usr/local/mapserver/shared/my.palette" # needs to be a full path</p>
<p class="p1">  END</p>
<p class="p1"><br>
</p>
<p class="p1">where the palette file is just a text file with a bunch of RGB triplets:</p>
<p class="p1"><br>
</p>
<p class="p1">  <span style="font-size: 10pt;">201,222,252</span></p>
<p class="p1">  40,172,218</p>
</div>
<div>  ...</div>
<div><br>
</div>
<div>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.</div>
<div><br>
</div>
<div>Steve</div>
<br>
<div style="font-family: Times New Roman; color: #000000; font-size: 16px">
<hr tabindex="-1">
<div id="divRpF60089" style="direction: ltr;"><font face="Tahoma" size="2" color="#000000"><b>From:</b> mapserver-users [mapserver-users-bounces@lists.osgeo.org] on behalf of Richard Greenwood [richard.greenwood@gmail.com]<br>
<b>Sent:</b> Friday, January 15, 2016 8:43 PM<br>
<b>To:</b> mapserver<br>
<b>Subject:</b> [mapserver-users] running out of colors in PC256 output<br>
</font><br>
</div>
<div></div>
<div>
<div dir="ltr">
<div>
<div>
<div>
<div>I'm running into more or less the same problem described in this 12 year old ticket:<br>
  <a href="https://trac.osgeo.org/mapserver/ticket/397" target="_blank">https://trac.osgeo.org/mapserver/ticket/397</a><br>
</div>
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.<br>
<br>
</div>
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.<br>
<br>
</div>
Any other suggestions?<br>
<br>
</div>
Thanks<br clear="all">
<div>
<div>
<div>
<div>
<div><br>
-- <br>
<div class="gmail_signature">
<div dir="ltr">Richard W. Greenwood, PLS<br>
<a href="http://www.greenwoodmap.com" target="_blank">www.greenwoodmap.com</a></div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</body>
</html>