those artifacts are most likely due to jpeg compression. you can force the output to be aliased and contain only your requested colors by hand crafting a special palette; search the docs for "formatoption + palette"<div>Thomas<br><br><div class="gmail_quote"><div dir="ltr">Le mer. 1 août 2018 à 16:32, Luke Wendling <<a href="mailto:luke@slingshotaerospace.com">luke@slingshotaerospace.com</a>> a écrit :<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>Mapserver version 7.1</div><div><br></div>Hi, To create a bitmask image (for computer vision model training), I'm creating a mapserver vector layer with TYPE POLYGON and setting the map IMAGECOLOR as 0 0 0. The Layer config is <div>CLASS</div><div>  STYLE</div><div>     COLOR 255 255 255</div><div>     ANTIALIAS false</div><div><br></div><div>However the resulting raster image has gray spots as shown below:</div><div><br></div><div><div><img src="cid:ii_jkbce7xj0" alt="image.png" width="512" height="504" id="iii_jkbce7xj0" class="nativeView"><br></div><br></div><div>I'm less concerned about the outer edge (maybe antialiasing?) and more interested in the inner gray areas. Can anyone help explain what's happening or give pointers on how to create a proper bitmask (all black or white)?</div><div><br></div><div>Full mapfile is below</div><div><br></div><div><div style="color:rgb(212,212,212);background-color:rgb(30,30,30);font-family:"Droid Sans Mono",monospace,monospace,"Droid Sans Fallback";font-weight:normal;font-size:14px;line-height:19px;white-space:pre-wrap"><br><div><span style="color:rgb(212,212,212)">MAP</span></div><div><span style="color:rgb(212,212,212)">  NAME valid</span></div><div><span style="color:rgb(212,212,212)">  STATUS ON</span></div><div><span style="color:rgb(212,212,212)">  PROJECTION</span></div><div><span style="color:rgb(212,212,212)">    "init=epsg:4326"</span></div><div><span style="color:rgb(212,212,212)">  END</span></div><br><div><span style="color:rgb(212,212,212)">  IMAGECOLOR 0 0 0</span></div><br><div><span style="color:rgb(212,212,212)">  # Register the image/tiff format so we can return 4 band images.</span></div><div><span style="color:rgb(212,212,212)">  OUTPUTFORMAT</span></div><div><span style="color:rgb(212,212,212)">    NAME GEOTIFF</span></div><div><span style="color:rgb(212,212,212)">    DRIVER "GDAL/GTiff"</span></div><div><span style="color:rgb(212,212,212)">    MIMETYPE "image/tiff"</span></div><div><span style="color:rgb(212,212,212)">    IMAGEMODE BYTE</span></div><div><span style="color:rgb(212,212,212)">    EXTENSION "tif"</span></div><div><span style="color:rgb(212,212,212)">    FORMATOPTION "ALPHA=UNSPECIFIED"</span></div><div><span style="color:rgb(212,212,212)">    FORMATOPTION "TILED=YES"</span></div><div><span style="color:rgb(212,212,212)">    </span><span style="color:rgb(96,139,78)">{# FORMATOPTION "COMPRESS=JPEG" #}</span></div><div><span style="color:rgb(212,212,212)">  END</span></div><br><div><span style="color:rgb(212,212,212)">  CONFIG "AWS_ACCESS_KEY_ID" "{{ </span><span style="color:rgb(156,220,254)">AWS_ACCESS_KEY_ID</span><span style="color:rgb(212,212,212)"> }}"</span></div><div><span style="color:rgb(212,212,212)">  CONFIG "AWS_SECRET_ACCESS_KEY" "{{ </span><span style="color:rgb(156,220,254)">AWS_SECRET_ACCESS_KEY</span><span style="color:rgb(212,212,212)"> }}"</span></div><div><span style="color:rgb(212,212,212)">  CONFIG "DEFAULT_REGION" "{{ </span><span style="color:rgb(156,220,254)">DEFAULT_REGION</span><span style="color:rgb(212,212,212)"> }}"</span></div><br><div><span style="color:rgb(212,212,212)">  WEB</span></div><div><span style="color:rgb(212,212,212)">    METADATA</span></div><div><span style="color:rgb(212,212,212)">      "wms_title"           "Slingshot WMS Server"</span></div><div><span style="color:rgb(212,212,212)">      "wms_onlineresource"  "{{ </span><span style="color:rgb(156,220,254)">wms_onlineresource</span><span style="color:rgb(212,212,212)"> }}"</span></div><div><span style="color:rgb(212,212,212)">      "wms_enable_request"  "GetCapabilities GetMap GetFeatureInfo"</span></div><div><span style="color:rgb(212,212,212)">      "wms_srs"             "EPSG:4326 EPSG:3857"</span></div><div><span style="color:rgb(212,212,212)">  END</span></div><div><span style="color:rgb(212,212,212)">  END</span></div><br><div><span style="color:rgb(212,212,212)">  {% </span><span style="color:rgb(197,134,192)">for</span><span style="color:rgb(212,212,212)"> </span><span style="color:rgb(156,220,254)">layer</span><span style="color:rgb(212,212,212)"> </span><span style="color:rgb(197,134,192)">in</span><span style="color:rgb(212,212,212)"> </span><span style="color:rgb(156,220,254)">layers</span><span style="color:rgb(212,212,212)"> %}</span></div><div><span style="color:rgb(212,212,212)">  # =========== {{</span><span style="color:rgb(156,220,254)">layer</span><span style="color:rgb(212,212,212)">.</span><span style="color:rgb(156,220,254)">title</span><span style="color:rgb(212,212,212)">}} =========== </span></div><div><span style="color:rgb(212,212,212)">  {% </span><span style="color:rgb(197,134,192)">if</span><span style="color:rgb(212,212,212)"> </span><span style="color:rgb(156,220,254)">layer</span><span style="color:rgb(212,212,212)">.</span><span style="color:rgb(156,220,254)">is_vector</span><span style="color:rgb(212,212,212)"> %}</span></div><div><span style="color:rgb(212,212,212)">  LAYER</span></div><div><span style="color:rgb(212,212,212)">    NAME "{{ </span><span style="color:rgb(156,220,254)">layer</span><span style="color:rgb(212,212,212)">.</span><span style="color:rgb(156,220,254)">name</span><span style="color:rgb(212,212,212)"> }}"</span></div><div><span style="color:rgb(212,212,212)">    STATUS ON</span></div><div><span style="color:rgb(212,212,212)">    TYPE POLYGON</span></div><div><span style="color:rgb(212,212,212)">    {{ </span><span style="color:rgb(156,220,254)">layer_params</span><span style="color:rgb(212,212,212)">(</span><span style="color:rgb(156,220,254)">layer</span><span style="color:rgb(212,212,212)">) }}</span></div><div><span style="color:rgb(212,212,212)">    CONNECTIONTYPE POSTGIS</span></div><div><span style="color:rgb(212,212,212)">    CONNECTION "host={{</span><span style="color:rgb(156,220,254)">db</span><span style="color:rgb(212,212,212)">.</span><span style="color:rgb(156,220,254)">host</span><span style="color:rgb(212,212,212)">}} port={{</span><span style="color:rgb(156,220,254)">db</span><span style="color:rgb(212,212,212)">.</span><span style="color:rgb(156,220,254)">port</span><span style="color:rgb(212,212,212)">}} dbname={{</span><span style="color:rgb(156,220,254)">db</span><span style="color:rgb(212,212,212)">.</span><span style="color:rgb(156,220,254)">name</span><span style="color:rgb(212,212,212)">}} user={{</span><span style="color:rgb(156,220,254)">db</span><span style="color:rgb(212,212,212)">.</span><span style="color:rgb(156,220,254)">user</span><span style="color:rgb(212,212,212)">}} password={{</span><span style="color:rgb(156,220,254)">db</span><span style="color:rgb(212,212,212)">.</span><span style="color:rgb(156,220,254)">password</span><span style="color:rgb(212,212,212)">}}"</span></div><div><span style="color:rgb(212,212,212)">    {% </span><span style="color:rgb(197,134,192)">if</span><span style="color:rgb(212,212,212)"> </span><span style="color:rgb(206,145,120)">'sql'</span><span style="color:rgb(212,212,212)"> </span><span style="color:rgb(197,134,192)">in</span><span style="color:rgb(212,212,212)"> </span><span style="color:rgb(156,220,254)">layer</span><span style="color:rgb(212,212,212)">.</span><span style="color:rgb(156,220,254)">metadata</span><span style="color:rgb(212,212,212)">.</span><span style="color:rgb(156,220,254)">mapserver</span><span style="color:rgb(212,212,212)"> %}</span></div><div><span style="color:rgb(212,212,212)">    DATA "geometry from ({{ </span><span style="color:rgb(156,220,254)">layer</span><span style="color:rgb(212,212,212)">.</span><span style="color:rgb(156,220,254)">metadata</span><span style="color:rgb(212,212,212)">.</span><span style="color:rgb(156,220,254)">mapserver</span><span style="color:rgb(212,212,212)">.</span><span style="color:rgb(156,220,254)">sql</span><span style="color:rgb(212,212,212)"> }}) as geometry using unique id"</span></div><div><span style="color:rgb(212,212,212)">    {% </span><span style="color:rgb(197,134,192)">else</span><span style="color:rgb(212,212,212)"> %}</span></div><div><span style="color:rgb(212,212,212)">    DATA "geometry from (select v.geometry, <a href="http://v.id" target="_blank">v.id</a> from images_vector v inner join images_provider p on (v.source_id = <a href="http://p.id" target="_blank">p.id</a>) where <a href="http://p.name" target="_blank">p.name</a> = '{{ </span><span style="color:rgb(156,220,254)">layer</span><span style="color:rgb(212,212,212)">.</span><span style="color:rgb(156,220,254)">metadata</span><span style="color:rgb(212,212,212)">.</span><span style="color:rgb(156,220,254)">provider</span><span style="color:rgb(212,212,212)"> }}') as geometry using unique id"</span></div><div><span style="color:rgb(212,212,212)">    {% </span><span style="color:rgb(197,134,192)">endif</span><span style="color:rgb(212,212,212)"> %}</span></div><div><span style="color:rgb(212,212,212)">    PROJECTION</span></div><div><span style="color:rgb(212,212,212)">      "init=epsg:4326"</span></div><div><span style="color:rgb(212,212,212)">    END</span></div><div><span style="color:rgb(212,212,212)">    CLASS</span></div><div><span style="color:rgb(212,212,212)">      STYLE</span></div><div><span style="color:rgb(212,212,212)">        COLOR 255 255 255</span></div><div><span style="color:rgb(212,212,212)">        ANTIALIAS false</span></div><div><span style="color:rgb(212,212,212)">      END</span></div><div><span style="color:rgb(212,212,212)">    END</span></div><div><span style="color:rgb(212,212,212)">  END</span></div><div><span style="color:rgb(212,212,212)">  {% </span><span style="color:rgb(197,134,192)">endif</span><span style="color:rgb(212,212,212)"> %}</span></div><div><span style="color:rgb(212,212,212)">  {% </span><span style="color:rgb(197,134,192)">endfor</span><span style="color:rgb(212,212,212)"> %}</span></div><br><div><span style="color:rgb(212,212,212)">END</span></div></div><br></div></div>
_______________________________________________<br>
mapserver-users mailing list<br>
<a href="mailto:mapserver-users@lists.osgeo.org" target="_blank">mapserver-users@lists.osgeo.org</a><br>
<a href="https://lists.osgeo.org/mailman/listinfo/mapserver-users" rel="noreferrer" target="_blank">https://lists.osgeo.org/mailman/listinfo/mapserver-users</a></blockquote></div></div>