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.

Of course you’d have to live with 1 pixel wide lines…

Steve

From: Erik H [mailto:[email protected]]
Sent: Monday, October 16, 2017 1:15 PM
To: Lime, Steve D (MNIT) <[email protected]>
Cc: [email protected]
Subject: Re: [mapserver-users] Draw roads WITHOUT anti-aliasing

Thanks for your reply, but I should have mentioned that I have a LOT of 
different colors to be displayed, almost a million...

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.

On Mon, Oct 16, 2017 at 2:00 PM, Lime, Steve D (MNIT) 
<[email protected]<mailto:[email protected]>> wrote:
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:

     FORMATOPTION "PALETTE_FORCE=TRUE"
    FORMATOPTION "PALETTE=palette.txt"

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.


-          
http://maps1.dnr.state.mn.us/cgi-bin/mapserv70?map=/usr/local/mapserver/apps/test/palette/test.map&mode=map
 (24-bit)

-          
http://maps1.dnr.state.mn.us/cgi-bin/mapserv70?map=/usr/local/mapserver/apps/test/palette/test.map&mode=map&map.imagetype=png8
 (8-bit w/5 colors)

Steve

From: mapserver-users 
[mailto:[email protected]<mailto:[email protected]>]
 On Behalf Of Erik H
Sent: Monday, October 16, 2017 10:58 AM
To: [email protected]<mailto:[email protected]>
Subject: [mapserver-users] Draw roads WITHOUT anti-aliasing

I'm running a tiling server that uses MapServer 7.0.4 to generate PNGs.

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.

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.

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.

Any suggestions?

Thanks.

_______________________________________________
mapserver-users mailing list
[email protected]
https://lists.osgeo.org/mailman/listinfo/mapserver-users

Reply via email to