<div dir="ltr">Andreas,<div><br></div><div>I have built a version of MapServer without AA enabled in mapagg.cpp as you have suggested. The reduction in file size is remarkable. In some cases it is 1/2 the size of a GD/GIF or an optimized AGG/PNG8. Aesthetically the images are pretty bad at first, but by softening the colors in the map file and reducing the color contrast between adjacent features I'm getting images that are acceptable. I will try experimenting with Cairo driver modifications next. Thank you very much for your suggestion and detailed explanation.</div><div><br></div><div>Rich</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, May 19, 2021 at 5:38 AM Eichner, Andreas - SID <<a href="mailto:Andreas.Eichner@sid.sachsen.de">Andreas.Eichner@sid.sachsen.de</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">What AGG does with it's sub-pixel accuracy can be viewed as computing the contribution of the pixels of a virtually larger image to the pixels of the final image. It uses a gamma function to translate the amount of virtual pixels into an amount of visual impact on the final pixel - both expressed as a value in the range 0..1. AGG's default is a linear function that proportionally maps the range 0..1 onto 0..1 (i.e. y=x). MapServer (where applied) uses a linear gamma function that proportionally maps the range 0..gamma onto 0..1. All this results in intermediate color values giving a smoother and visually improved result as in this example: <a href="https://commons.wikimedia.org/wiki/File:Antialiasing.png#/media/Datei:Antialiasing.png" rel="noreferrer" target="_blank">https://commons.wikimedia.org/wiki/File:Antialiasing.png#/media/Datei:Antialiasing.png</a><br>
<br>
As PNG uses lossless compression these additional information enlarges the resulting files. So to reduce the size of your map image files it's best to turn anti-aliasing off. One way is to compile a special version with modified typedefs in mapagg.cpp to turn AA off. With Cairo you could use the method cairo_set_antialias(cairo_t*, CAIRO_ANTIALIAS_NONE) to switch it off. But then you would loose paletted image and compression control.<br>
<br>
With the modified AGG you should still apply the other suggestions with reduced palette and maximum compression.<br>
<br>
HTH<br>
<br>
<br>
-----Ursprüngliche Nachricht-----<br>
Von: mapserver-users <<a href="mailto:mapserver-users-bounces@lists.osgeo.org" target="_blank">mapserver-users-bounces@lists.osgeo.org</a>> Im Auftrag von Richard Greenwood<br>
Gesendet: Dienstag, 18. Mai 2021 18:50<br>
An: mapserver <<a href="mailto:mapserver-users@lists.osgeo.org" target="_blank">mapserver-users@lists.osgeo.org</a>><br>
Betreff: [mapserver-users] anti-aliasing (was differing image size with different mapserver versions)<br>
<br>
Thanks to several helpful replies to my previous thread I know that the increased image size between MapServer 6 with the GD driver and MapServer 7 with the AGG driver is due to differences in anti-aliasing (and lack of) in the two drivers. (AGG features anti-aliasing and sub-pixel resolution <<a href="https://en.wikipedia.org/wiki/Anti-Grain_Geometry" rel="noreferrer" target="_blank">https://en.wikipedia.org/wiki/Anti-Grain_Geometry</a>> ).<br>
<br>
Gamma setting from 0-1 affects the size of a filled polygon layer by a factor of almost 3x. But gamma has no effect on text, lines, and polygon outlines. So images comprised of these types of features are approximately 2x larger with the AGG/PNG8 driver than with the GD/GIF driver. <br>
<br>
Where else should I be looking to reduce my images sizes? I serve rural areas with poor internet so in my case, smaller image sizes are more important than higher quality images.<br>
<br>
Thanks,<br>
Rich<br>
<br>
-- <br>
<br>
Richard W. Greenwood, PLS<br>
<a href="http://www.greenwoodmap.com" rel="noreferrer" target="_blank">www.greenwoodmap.com</a> <<a href="http://www.greenwoodmap.com" rel="noreferrer" target="_blank">http://www.greenwoodmap.com</a>> <br>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" 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>