<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman",serif;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
p.m1532385765130021136msolistparagraph, li.m1532385765130021136msolistparagraph, div.m1532385765130021136msolistparagraph
        {mso-style-name:m_1532385765130021136msolistparagraph;
        mso-margin-top-alt:auto;
        margin-right:0in;
        mso-margin-bottom-alt:auto;
        margin-left:0in;
        font-size:12.0pt;
        font-family:"Times New Roman",serif;}
span.EmailStyle18
        {mso-style-type:personal;
        font-family:"Calibri",sans-serif;
        color:#1F497D;}
span.EmailStyle19
        {mso-style-type:personal-compose;
        font-family:"Calibri",sans-serif;
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;
        font-family:"Calibri",sans-serif;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-US" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D">So you really do need 24-bit output. I was looking back through the mailing list archives and it was mentioned back in 2012 that aliased output could be implemented
 for simple (1 pixel-wide) lines and polygons – so there is hope but I don’t believe (looking through the source) that Thomas ever fully implemented it. In mapagg.cpp there are ifdef’s for a symbol named AGG_ALIASED_ENABLED which makes me wonder if work was
 started. I tried setting that in mapagg.cpp but ran into compile errors and didn’t try and track those down.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D">Of course you’d have to live with 1 pixel wide lines…<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D">Steve<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><b><span style="font-size:11.0pt;font-family:"Calibri",sans-serif">From:</span></b><span style="font-size:11.0pt;font-family:"Calibri",sans-serif"> Erik H [mailto:erik.h11.01@gmail.com]
<br>
<b>Sent:</b> Monday, October 16, 2017 1:15 PM<br>
<b>To:</b> Lime, Steve D (MNIT) <steve.lime@state.mn.us><br>
<b>Cc:</b> mapserver-users@lists.osgeo.org<br>
<b>Subject:</b> Re: [mapserver-users] Draw roads WITHOUT anti-aliasing<o:p></o:p></span></p>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<p class="MsoNormal">Thanks for your reply, but I should have mentioned that I have a LOT of different colors to be displayed, almost a million...<o:p></o:p></p>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">I should also have mentioned that I've already tried to filter out the anti-aliased pixels by setting all alpha bytes to 255 and then assuming that all pixels that don't have alpha=255 in the PNG can be removed, but that assumption seems
 to be wrong.<o:p></o:p></p>
</div>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<p class="MsoNormal">On Mon, Oct 16, 2017 at 2:00 PM, Lime, Steve D (MNIT) <<a href="mailto:steve.lime@state.mn.us" target="_blank">steve.lime@state.mn.us</a>> wrote:<o:p></o:p></p>
<blockquote style="border:none;border-left:solid #CCCCCC 1.0pt;padding:0in 0in 0in 6.0pt;margin-left:4.8pt;margin-top:5.0pt;margin-right:0in;margin-bottom:5.0pt">
<div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D">Hmmm… I wonder if you just could use a pre-computed palette to control quantizing to 8 bits. You can
 supply a palette file (RGB or RGBA) and the MapServer will map 24/32-bit values to those in the palette. Format options are:</span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D"> </span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D">     FORMATOPTION "PALETTE_FORCE=TRUE"</span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D">    FORMATOPTION "PALETTE=palette.txt"</span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D"> </span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D">This will definitely limit the colors in your output image to those you specify. The question is whether
 or not the anti-aliased colors will map to the right color and that will depend on your palette. I did write a simple test with a 5 color palette (black, white, red, green and blue) and it seems to work ok but that’s a very simple palette… Based on your application
 it might work though.</span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D"> </span><o:p></o:p></p>
<p class="m1532385765130021136msolistparagraph" style="margin-left:24.75pt"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D">-</span><span style="font-size:7.0pt;color:#1F497D">         
</span><a href="http://maps1.dnr.state.mn.us/cgi-bin/mapserv70?map=/usr/local/mapserver/apps/test/palette/test.map&mode=map" target="_blank"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif">http://maps1.dnr.state.mn.us/cgi-bin/mapserv70?map=/usr/local/mapserver/apps/test/palette/test.map&mode=map</span></a><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D">
 (24-bit)</span><o:p></o:p></p>
<p class="m1532385765130021136msolistparagraph" style="margin-left:24.75pt"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D">-</span><span style="font-size:7.0pt;color:#1F497D">         
</span><a href="http://maps1.dnr.state.mn.us/cgi-bin/mapserv70?map=/usr/local/mapserver/apps/test/palette/test.map&mode=map&map.imagetype=png8" target="_blank"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif">http://maps1.dnr.state.mn.us/cgi-bin/mapserv70?map=/usr/local/mapserver/apps/test/palette/test.map&mode=map&map.imagetype=png8</span></a><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D">
 (8-bit w/5 colors)</span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D"> </span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D">Steve</span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D"> </span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><b><span style="font-size:11.0pt;font-family:"Calibri",sans-serif">From:</span></b><span style="font-size:11.0pt;font-family:"Calibri",sans-serif"> mapserver-users [mailto:</span><a href="mailto:mapserver-users-bounces@lists.osgeo.org" target="_blank"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif">mapserver-users-bounces@lists.osgeo.org</span></a><span style="font-size:11.0pt;font-family:"Calibri",sans-serif">]
<b>On Behalf Of </b>Erik H<br>
<b>Sent:</b> Monday, October 16, 2017 10:58 AM<br>
<b>To:</b> </span><a href="mailto:mapserver-users@lists.osgeo.org" target="_blank"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif">mapserver-users@lists.osgeo.org</span></a><span style="font-size:11.0pt;font-family:"Calibri",sans-serif"><br>
<b>Subject:</b> [mapserver-users] Draw roads WITHOUT anti-aliasing</span><o:p></o:p></p>
<div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"> <o:p></o:p></p>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">I'm running a tiling server that uses MapServer 7.0.4 to generate PNGs.<o:p></o:p></p>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"> <o:p></o:p></p>
</div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">My colleagues came up with an ingenious idea to animate traffic conditions that would require them to identify road segments based on their color. They asked me to generate tiles
 with a predetermined RGBA value per road segment. <o:p></o:p></p>
</div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"> <o:p></o:p></p>
</div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">I configured a layer of type LINE, with a STYLE section containing 'COLOR [palette]' (palette being a field in the database query). Initially, I thought I was creating the images
 my colleagues needed, but it seems that the anti-aliasing causes some pixels to have colors other than the one I specified; this prevents us from identifying the road segments.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"> <o:p></o:p></p>
</div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">We can live without anti-aliasing, but I was unable to turn it off; I tried both the AGG/PNG and GD/PNG drivers and messed with various FORMATOPTION identifiers, but nothing seemed
 to make any difference.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"> <o:p></o:p></p>
</div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">Any suggestions?<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"> <o:p></o:p></p>
</div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">Thanks.<o:p></o:p></p>
</div>
</div>
</div>
</div>
</div>
</div>
</blockquote>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
</div>
</body>
</html>