[mapserver-users] anti-aliasing (was differing image size with different mapserver versions)

Eichner, Andreas - SID Andreas.Eichner at sid.sachsen.de
Wed May 19 07:21:49 PDT 2021


This should make the keyword ANTIALIAS in line styles work as expected and draw linestrings aliased if set to FALSE. But this works not only be adding another typedef. It also adds another member of that type and to use it the agg2Render*-methods need to selectively switch between the both according to the value set in the style. Currently only agg2RenderLine() does that. Others like agg2RenderPolygon() or agg2RenderGlyphsPath() for rendering polygons and text simply ignore that value and simply use the anti-aliasing one.

-----Ursprüngliche Nachricht-----
Von: Rahkonen Jukka (MML) <jukka.rahkonen at maanmittauslaitos.fi> 
Gesendet: Mittwoch, 19. Mai 2021 15:49
An: Eichner, Andreas - SID <Andreas.Eichner at sid.sachsen.de>; Richard Greenwood <richard.greenwood at gmail.com>; mapserver <mapserver-users at lists.osgeo.org>
Betreff: Re: [mapserver-users] anti-aliasing (was differing image size with different mapserver versions)

Hi,

Can someone say if the issue is already fixed or not by  https://github.com/MapServer/MapServer/pull/6225/files

that adds:
typedef mapserver::renderer_scanline_bin_solid<renderer_base> renderer_scanline_aliased;

Is this enough for turning antialiasing off and making png files with lots of linework smaller? Should/could there be something more for polygons which are rendered with plain fill without borderlines?

-Jukka Rahkonen-

-----Alkuperäinen viesti-----
Lähettäjä: mapserver-users <mapserver-users-bounces at lists.osgeo.org> Puolesta Eichner, Andreas - SID
Lähetetty: keskiviikko 19. toukokuuta 2021 14.39
Vastaanottaja: Richard Greenwood <richard.greenwood at gmail.com>; mapserver <mapserver-users at lists.osgeo.org>
Aihe: Re: [mapserver-users] anti-aliasing (was differing image size with different mapserver versions)

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: https://commons.wikimedia.org/wiki/File:Antialiasing.png#/media/Datei:Antialiasing.png

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.

With the modified AGG you should still apply the other suggestions with reduced palette and maximum compression.

HTH


-----Ursprüngliche Nachricht-----
Von: mapserver-users <mapserver-users-bounces at lists.osgeo.org> Im Auftrag von Richard Greenwood
Gesendet: Dienstag, 18. Mai 2021 18:50
An: mapserver <mapserver-users at lists.osgeo.org>
Betreff: [mapserver-users] anti-aliasing (was differing image size with different mapserver versions)

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 <https://en.wikipedia.org/wiki/Anti-Grain_Geometry> ).

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. 

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.

Thanks,
Rich

-- 

Richard W. Greenwood, PLS
www.greenwoodmap.com <http://www.greenwoodmap.com> _______________________________________________
mapserver-users mailing list
mapserver-users at lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/mapserver-users


More information about the mapserver-users mailing list