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

2021-05-23 Thread Richard Greenwood
I did some testing and summarized my results in this Google spreadsheet
<https://docs.google.com/spreadsheets/d/169tfJbAciEO0ojLKkteyzfMTaueS2vHDp4tPw4l6szk/edit#gid=872662075>.
My initial goal was to switch from MapServer 6 to 7, and thus from GIF to
PNG since the GD/GIF driver is gone in MapServer 7. I'm looking for a
palleted PNG format similar in size to GIF. PNG uses sub-pixel
anti-aliasing which makes images larger than GIFs which uses color
interpolation to anti-alias. MapServer 7 does not have a built-in
mechanism to disable anti-aliasing in either the AGG or Cairo drivers but
with minor modifications to the source code it can be disabled. The
spreadsheet compares five output formats: GD/GIF, AGG/PNG8, AGG/PNG8 w/o
anti-aliasing, Cairo/PNG8, and Cairo/PNG8 w/o anti-aliasing.

I used three different source maps with significantly different content
(they're linked in the spreadsheet). Not surprisingly, the PNG8 images look
the best, GIF looks okay, and images without anti-aliasing look pretty
poor. The size of the images generally corresponds to the visual quality.
In other words, I did not find any magic way to consistently make really
nice, really small images. But depending on the content there are some ways
to significantly reduce size and still get a nice looking image.

The spreadsheet includes some timing tests. I did these with Apache Bench,
they're not especially rigorous.

Thanks to all who commented on this thread, I learned quite a bit.
Rich

On Thu, May 20, 2021 at 2:58 AM Eichner, Andreas - SID <
andreas.eich...@sid.sachsen.de> wrote:

> Well, anti-aliased maps look much better and are basically the way to go.
> But in some corner cases it would be great to be able to turn this feature
> off. Cairo provides a single switch to do that and a patch that enables
> control over that from within MapServer can be simple and straight forward.
> With a little more effort this can be extended to switch between all
> possible CAIRO_ANTIALIAS_* values. So IMHO integrating this option for the
> Cairo renderer seems to be a good idea. For the AGG renderer it requires
> more work to make this runtime controllable.
>
> @Richard: The difference between both renderers is impressive. Since you
> are using this with much more complex maps can you give some feedback which
> one which one looks "better" (with tuning applied) and how usable the
> result is?
>
> Regards, Andreas
>
> -Ursprüngliche Nachricht-
> Von: Steve Lime 
> Gesendet: Mittwoch, 19. Mai 2021 18:24
> An: Eichner, Andreas - SID 
> Cc: Richard Greenwood ; mapserver <
> mapserver-users@lists.osgeo.org>
> Betreff: Re: [mapserver-users] anti-aliasing (was differing image size
> with different mapserver versions)
>
> Worth adding to main?
>
> On Wed, May 19, 2021 at 10:15 AM Eichner, Andreas - SID <
> andreas.eich...@sid.sachsen.de <mailto:andreas.eich...@sid.sachsen.de> >
> wrote:
>
>
> If you want to give Cairo a try, you could modify mapcairo.c like
> this:
>
> diff --git a/mapcairo.c b/mapcairo.c
> index 0f4cc094..d28947d6 100644
> --- a/mapcairo.c
> +++ b/mapcairo.c
> @@ -517,6 +517,12 @@ imageObj* createImageCairo(int width, int
> height, outputFormatObj *format,colorO
>
>  cairo_set_line_cap (r->cr,CAIRO_LINE_CAP_ROUND);
>  cairo_set_line_join(r->cr,CAIRO_LINE_JOIN_ROUND);
> +{
> +const char* antialias = msGetOutputFormatOption(format,
> "ANTIALIAS", "TRUE");
> +if (EQUAL(antialias, "OFF") || EQUAL(antialias, "FALSE")
> || EQUAL(antialias, "0")) {
> +cairo_set_antialias(r->cr, CAIRO_ANTIALIAS_NONE);
> +}
> +}
>  image->img.plugin = (void*)r;
>} else {
>  msSetError(MS_RENDERERERR, "Cannot create cairo image of size
> %dx%d.",
>
> This adds a FORMATOPTION "ANTIALIAS" to the CAIRO/*-Drivers that
> defaults to TRUE. But when explicitly set to 0/OFF/FALSE it calls
> cairo_set_antialias() to disable it. The raster buffer created by the CAIRO
> renderer is passed to the PNG writer which enables COMPRESSION,
> PALETTE_FORCE, QUANTIZE_FORCE. So you can combine it:
>
>  OUTPUTFORMAT
>NAME "cairopng"
>DRIVER CAIRO/PNG
>MIMETYPE "image/png"
>IMAGEMODE RGB
>EXTENSION "png"
>FORMATOPTION "ANTIALIAS=FALSE"
>FORMATOPTION "QUANTIZE_FORCE=ON"
>FORMATOPTION "QUANTIZE_COLORS=256"
>FORMATOPTION "COMPRESSION=9"
>  END
>
> I used the msautotest/renderers/line_simple.map example to test
> and that crushed the resulting png from 5920 bytes down to 947 bytes.
>
> HTH, Andreas
>
>
>
>

-- 
Richard W. Greenwood, PLS
www.greenwoodmap.com
___
mapserver-users mailing list
mapserver-users@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/mapserver-users


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

2021-05-20 Thread Eichner, Andreas - SID
Well, anti-aliased maps look much better and are basically the way to go. But 
in some corner cases it would be great to be able to turn this feature off. 
Cairo provides a single switch to do that and a patch that enables control over 
that from within MapServer can be simple and straight forward. With a little 
more effort this can be extended to switch between all possible 
CAIRO_ANTIALIAS_* values. So IMHO integrating this option for the Cairo 
renderer seems to be a good idea. For the AGG renderer it requires more work to 
make this runtime controllable. 

@Richard: The difference between both renderers is impressive. Since you are 
using this with much more complex maps can you give some feedback which one 
which one looks "better" (with tuning applied) and how usable the result is?

Regards, Andreas

-Ursprüngliche Nachricht-
Von: Steve Lime  
Gesendet: Mittwoch, 19. Mai 2021 18:24
An: Eichner, Andreas - SID 
Cc: Richard Greenwood ; mapserver 

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

Worth adding to main?

On Wed, May 19, 2021 at 10:15 AM Eichner, Andreas - SID 
mailto:andreas.eich...@sid.sachsen.de> > wrote:


If you want to give Cairo a try, you could modify mapcairo.c like this:

diff --git a/mapcairo.c b/mapcairo.c
index 0f4cc094..d28947d6 100644
--- a/mapcairo.c
+++ b/mapcairo.c
@@ -517,6 +517,12 @@ imageObj* createImageCairo(int width, int height, 
outputFormatObj *format,colorO

 cairo_set_line_cap (r->cr,CAIRO_LINE_CAP_ROUND);
 cairo_set_line_join(r->cr,CAIRO_LINE_JOIN_ROUND);
+{
+const char* antialias = msGetOutputFormatOption(format, 
"ANTIALIAS", "TRUE");
+if (EQUAL(antialias, "OFF") || EQUAL(antialias, "FALSE") || 
EQUAL(antialias, "0")) {
+cairo_set_antialias(r->cr, CAIRO_ANTIALIAS_NONE);
+}
+}
 image->img.plugin = (void*)r;
   } else {
 msSetError(MS_RENDERERERR, "Cannot create cairo image of size 
%dx%d.",

This adds a FORMATOPTION "ANTIALIAS" to the CAIRO/*-Drivers that 
defaults to TRUE. But when explicitly set to 0/OFF/FALSE it calls 
cairo_set_antialias() to disable it. The raster buffer created by the CAIRO 
renderer is passed to the PNG writer which enables COMPRESSION, PALETTE_FORCE, 
QUANTIZE_FORCE. So you can combine it:

 OUTPUTFORMAT
   NAME "cairopng"
   DRIVER CAIRO/PNG
   MIMETYPE "image/png"
   IMAGEMODE RGB
   EXTENSION "png"
   FORMATOPTION "ANTIALIAS=FALSE"
   FORMATOPTION "QUANTIZE_FORCE=ON"
   FORMATOPTION "QUANTIZE_COLORS=256"
   FORMATOPTION "COMPRESSION=9"
 END

I used the msautotest/renderers/line_simple.map example to test and 
that crushed the resulting png from 5920 bytes down to 947 bytes. 

HTH, Andreas



___
mapserver-users mailing list
mapserver-users@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/mapserver-users


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

2021-05-19 Thread Richard Greenwood
Andreas,

Very interesting. Your Cairo driver modifications create an image the same
size as your AGG driver modification that disables AA, but with strikingly
different appearance. Links to examples below. (The examples are pretty
ugly but with some work on the styles in the map file they could
significantly be improved) I have not tested performance yet.  Again -
thank you for your suggestions.

https://greenwoodmap.com/cairo-aliased.png CAIRO/PNG ANTIALIAS=FALSE
https://greenwoodmap.com/agg-aliased.png  AGG/PNG8
renderer_scanline_bin_solid


On Wed, May 19, 2021 at 9:15 AM Eichner, Andreas - SID <
andreas.eich...@sid.sachsen.de> wrote:

> If you want to give Cairo a try, you could modify mapcairo.c like this:
>
> diff --git a/mapcairo.c b/mapcairo.c
> index 0f4cc094..d28947d6 100644
> --- a/mapcairo.c
> +++ b/mapcairo.c
> @@ -517,6 +517,12 @@ imageObj* createImageCairo(int width, int height,
> outputFormatObj *format,colorO
>
>  cairo_set_line_cap (r->cr,CAIRO_LINE_CAP_ROUND);
>  cairo_set_line_join(r->cr,CAIRO_LINE_JOIN_ROUND);
> +{
> +const char* antialias = msGetOutputFormatOption(format,
> "ANTIALIAS", "TRUE");
> +if (EQUAL(antialias, "OFF") || EQUAL(antialias, "FALSE") ||
> EQUAL(antialias, "0")) {
> +cairo_set_antialias(r->cr, CAIRO_ANTIALIAS_NONE);
> +}
> +}
>  image->img.plugin = (void*)r;
>} else {
>  msSetError(MS_RENDERERERR, "Cannot create cairo image of size %dx%d.",
>
> This adds a FORMATOPTION "ANTIALIAS" to the CAIRO/*-Drivers that defaults
> to TRUE. But when explicitly set to 0/OFF/FALSE it calls
> cairo_set_antialias() to disable it. The raster buffer created by the CAIRO
> renderer is passed to the PNG writer which enables COMPRESSION,
> PALETTE_FORCE, QUANTIZE_FORCE. So you can combine it:
>
>  OUTPUTFORMAT
>NAME "cairopng"
>DRIVER CAIRO/PNG
>MIMETYPE "image/png"
>IMAGEMODE RGB
>EXTENSION "png"
>FORMATOPTION "ANTIALIAS=FALSE"
>FORMATOPTION "QUANTIZE_FORCE=ON"
>FORMATOPTION "QUANTIZE_COLORS=256"
>FORMATOPTION "COMPRESSION=9"
>  END
>
> I used the msautotest/renderers/line_simple.map example to test and that
> crushed the resulting png from 5920 bytes down to 947 bytes.
>
> HTH, Andreas
>
> -Ursprüngliche Nachricht-
> Von: Richard Greenwood 
> Gesendet: Mittwoch, 19. Mai 2021 16:12
> An: Eichner, Andreas - SID 
> Cc: mapserver 
> Betreff: Re: [mapserver-users] anti-aliasing (was differing image size
> with different mapserver versions)
>
> Andreas,
>
> 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.
>
> Rich
>
> On Wed, May 19, 2021 at 5:38 AM Eichner, Andreas - SID <
> andreas.eich...@sid.sachsen.de <mailto:andreas.eich...@sid.sachsen.de> >
> wrote:
>
>
> 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
> 

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

2021-05-19 Thread Steve Lime
Worth adding to main?

On Wed, May 19, 2021 at 10:15 AM Eichner, Andreas - SID <
andreas.eich...@sid.sachsen.de> wrote:

> If you want to give Cairo a try, you could modify mapcairo.c like this:
>
> diff --git a/mapcairo.c b/mapcairo.c
> index 0f4cc094..d28947d6 100644
> --- a/mapcairo.c
> +++ b/mapcairo.c
> @@ -517,6 +517,12 @@ imageObj* createImageCairo(int width, int height,
> outputFormatObj *format,colorO
>
>  cairo_set_line_cap (r->cr,CAIRO_LINE_CAP_ROUND);
>  cairo_set_line_join(r->cr,CAIRO_LINE_JOIN_ROUND);
> +{
> +const char* antialias = msGetOutputFormatOption(format,
> "ANTIALIAS", "TRUE");
> +if (EQUAL(antialias, "OFF") || EQUAL(antialias, "FALSE") ||
> EQUAL(antialias, "0")) {
> +cairo_set_antialias(r->cr, CAIRO_ANTIALIAS_NONE);
> +}
> +}
>  image->img.plugin = (void*)r;
>} else {
>  msSetError(MS_RENDERERERR, "Cannot create cairo image of size %dx%d.",
>
> This adds a FORMATOPTION "ANTIALIAS" to the CAIRO/*-Drivers that defaults
> to TRUE. But when explicitly set to 0/OFF/FALSE it calls
> cairo_set_antialias() to disable it. The raster buffer created by the CAIRO
> renderer is passed to the PNG writer which enables COMPRESSION,
> PALETTE_FORCE, QUANTIZE_FORCE. So you can combine it:
>
>  OUTPUTFORMAT
>NAME "cairopng"
>DRIVER CAIRO/PNG
>MIMETYPE "image/png"
>IMAGEMODE RGB
>EXTENSION "png"
>FORMATOPTION "ANTIALIAS=FALSE"
>FORMATOPTION "QUANTIZE_FORCE=ON"
>FORMATOPTION "QUANTIZE_COLORS=256"
>FORMATOPTION "COMPRESSION=9"
>  END
>
> I used the msautotest/renderers/line_simple.map example to test and that
> crushed the resulting png from 5920 bytes down to 947 bytes.
>
> HTH, Andreas
>
>
___
mapserver-users mailing list
mapserver-users@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/mapserver-users


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

2021-05-19 Thread Eichner, Andreas - SID
If you want to give Cairo a try, you could modify mapcairo.c like this:

diff --git a/mapcairo.c b/mapcairo.c
index 0f4cc094..d28947d6 100644
--- a/mapcairo.c
+++ b/mapcairo.c
@@ -517,6 +517,12 @@ imageObj* createImageCairo(int width, int height, 
outputFormatObj *format,colorO

 cairo_set_line_cap (r->cr,CAIRO_LINE_CAP_ROUND);
 cairo_set_line_join(r->cr,CAIRO_LINE_JOIN_ROUND);
+{
+const char* antialias = msGetOutputFormatOption(format, "ANTIALIAS", 
"TRUE");
+if (EQUAL(antialias, "OFF") || EQUAL(antialias, "FALSE") || 
EQUAL(antialias, "0")) {
+cairo_set_antialias(r->cr, CAIRO_ANTIALIAS_NONE);
+}
+}
 image->img.plugin = (void*)r;
   } else {
 msSetError(MS_RENDERERERR, "Cannot create cairo image of size %dx%d.",

This adds a FORMATOPTION "ANTIALIAS" to the CAIRO/*-Drivers that defaults to 
TRUE. But when explicitly set to 0/OFF/FALSE it calls cairo_set_antialias() to 
disable it. The raster buffer created by the CAIRO renderer is passed to the 
PNG writer which enables COMPRESSION, PALETTE_FORCE, QUANTIZE_FORCE. So you can 
combine it:

 OUTPUTFORMAT
   NAME "cairopng"
   DRIVER CAIRO/PNG
   MIMETYPE "image/png"
   IMAGEMODE RGB
   EXTENSION "png"
   FORMATOPTION "ANTIALIAS=FALSE"
   FORMATOPTION "QUANTIZE_FORCE=ON"
   FORMATOPTION "QUANTIZE_COLORS=256"
   FORMATOPTION "COMPRESSION=9"
 END

I used the msautotest/renderers/line_simple.map example to test and that 
crushed the resulting png from 5920 bytes down to 947 bytes. 

HTH, Andreas

-----Ursprüngliche Nachricht-
Von: Richard Greenwood  
Gesendet: Mittwoch, 19. Mai 2021 16:12
An: Eichner, Andreas - SID 
Cc: mapserver 
Betreff: Re: [mapserver-users] anti-aliasing (was differing image size with 
different mapserver versions)

Andreas,

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.

Rich

On Wed, May 19, 2021 at 5:38 AM Eichner, Andreas - SID 
mailto:andreas.eich...@sid.sachsen.de> > wrote:


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 mailto:mapserver-users-boun...@lists.osgeo.org> > Im Auftrag von Richard 
Greenwood
    Gesendet: Dienstag, 18. Mai 2021 18:50
    An: mapserver mailto:mapserver-users@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 th

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

2021-05-19 Thread Eichner, Andreas - SID
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)  
Gesendet: Mittwoch, 19. Mai 2021 15:49
An: Eichner, Andreas - SID ; Richard Greenwood 
; mapserver 
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_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  Puolesta 
Eichner, Andreas - SID
Lähetetty: keskiviikko 19. toukokuuta 2021 14.39
Vastaanottaja: Richard Greenwood ; mapserver 

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  Im Auftrag von 
Richard Greenwood
Gesendet: Dienstag, 18. Mai 2021 18:50
An: mapserver 
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@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/mapserver-users
___
mapserver-users mailing list
mapserver-users@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/mapserver-users


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

2021-05-19 Thread Richard Greenwood
Andreas,

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.

Rich

On Wed, May 19, 2021 at 5:38 AM Eichner, Andreas - SID <
andreas.eich...@sid.sachsen.de> wrote:

> 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  Im Auftrag
> von Richard Greenwood
> Gesendet: Dienstag, 18. Mai 2021 18:50
> An: mapserver 
> 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>
>


-- 
Richard W. Greenwood, PLS
www.greenwoodmap.com
___
mapserver-users mailing list
mapserver-users@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/mapserver-users


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

2021-05-19 Thread Rahkonen Jukka (MML)
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_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  Puolesta 
Eichner, Andreas - SID
Lähetetty: keskiviikko 19. toukokuuta 2021 14.39
Vastaanottaja: Richard Greenwood ; mapserver 

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  Im Auftrag von 
Richard Greenwood
Gesendet: Dienstag, 18. Mai 2021 18:50
An: mapserver 
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@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/mapserver-users
___
mapserver-users mailing list
mapserver-users@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/mapserver-users


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

2021-05-19 Thread Eichner, Andreas - SID
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  Im Auftrag von 
Richard Greenwood
Gesendet: Dienstag, 18. Mai 2021 18:50
An: mapserver 
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@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/mapserver-users


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

2021-05-18 Thread Richard Greenwood
I do automatically switch to JPEG when there's imagery or similar content
and could use JPEG more except where I need transparency, like when
overlaying a tiled background layer in OpenLayers.
I messed with the Cairo driver a little but it seems less flexible than
AGG. I haven't been too happy with vector tiles. And yeah, I know GD isn't
an option. Thanks Steve.




On Tue, May 18, 2021 at 1:30 PM Steve Lime  wrote:

> If you don't care about quality then JPEG is an option... ;-) I also
> wonder if there are ways to create true 8-bit output in other ways. No way
> GD comes back.
>
> On Tue, May 18, 2021 at 1:12 PM Richard Greenwood <
> richard.greenw...@gmail.com> wrote:
>
>> Oops - typo there, reducing the colors from 256 to *125* reduced the
>> image size by about 15%.
>>
>> On Tue, May 18, 2021 at 12:11 PM Richard Greenwood <
>> richard.greenw...@gmail.com> wrote:
>>
>>> Bob - I think GD was quite unpopular with the developers. Thomas Bonfort
>>> was pretty adamant about removing it. I'm hoping that there may be options
>>> in AGG.
>>>
>>> Seth - FORMATOPTION "COMPRESSION=9" only reduced the size by about 3% in
>>> my lines and text test case.
>>>
>>> Even - the default AGG/PNG8 has QUANTIZE_FORCE=on
>>> and QUANTIZE_COLORS=256. I think I remember you saying somewhere that
>>> reducing the number of colors mostly just reduced the pallet size and
>>> that's pretty much what I see. e.g. reducing the pallet from 256 to 15
>>> colors reduces the image size by about 15% in my lines and text test.
>>>
>>> Thanks all for the suggestions.
>>> Rich
>>>
>>>
>>> On Tue, May 18, 2021 at 11:49 AM Even Rouault <
>>> even.roua...@spatialys.com> wrote:
>>>
>>>> Forcing paletted images using QUANTIZE_FORCE=on and decreasing the number 
>>>> of colors with QUANTIZE_COLORS can also help:
>>>>
>>>>  FORMATOPTION "QUANTIZE_FORCE=on"
>>>>  FORMATOPTION "QUANTIZE_COLORS=200"
>>>>
>>>> Le 18/05/2021 à 19:30, Seth G a écrit :
>>>>
>>>> I've not used it but the following might help for the AGG/PNG driver:
>>>>
>>>> FORMATOPTION "COMPRESSION=9"
>>>>
>>>> https://mapserver.org/mapfile/outputformat.html
>>>>
>>>> The default is 6.
>>>>
>>>> --
>>>> web:http://geographika.co.uk
>>>> twitter: @geographika
>>>>
>>>>
>>>> On Tue, May 18, 2021, at 7:16 PM, Basques, Bob (CI-StPaul) wrote:
>>>>
>>>> All,
>>>>
>>>>
>>>>
>>>> I know the GD stuff has been a long running conversation in the
>>>> MapServer realm, but does this indicate that maybe discussing something on
>>>> adding GD back in might be prudent?  Or are there methods to get down to
>>>> these previous files sizes with the newer approaches?
>>>>
>>>>
>>>>
>>>> I have the same concerns related to image size from the performance
>>>> side, and running on Mobile in our case.
>>>>
>>>>
>>>>
>>>> Bobb
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> *From: *mapserver-users 
>>>>  on behalf of Richard
>>>> Greenwood  
>>>> *Date: *Tuesday, May 18, 2021 at 11:50 AM
>>>> *To: *"mapserver-users@lists.osgeo.org"
>>>>  
>>>> 
>>>> *Subject: *[mapserver-users] anti-aliasing (was differing image size
>>>> with different mapserver versions)
>>>>
>>>>
>>>>
>>>> *Think Before You Click: *This email originated *outside *our
>>>> organization.
>>>>
>>>>
>>>>
>>>> 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 o

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

2021-05-18 Thread Steve Lime
If you don't care about quality then JPEG is an option... ;-) I also wonder
if there are ways to create true 8-bit output in other ways. No way GD
comes back.

On Tue, May 18, 2021 at 1:12 PM Richard Greenwood <
richard.greenw...@gmail.com> wrote:

> Oops - typo there, reducing the colors from 256 to *125* reduced the
> image size by about 15%.
>
> On Tue, May 18, 2021 at 12:11 PM Richard Greenwood <
> richard.greenw...@gmail.com> wrote:
>
>> Bob - I think GD was quite unpopular with the developers. Thomas Bonfort
>> was pretty adamant about removing it. I'm hoping that there may be options
>> in AGG.
>>
>> Seth - FORMATOPTION "COMPRESSION=9" only reduced the size by about 3% in
>> my lines and text test case.
>>
>> Even - the default AGG/PNG8 has QUANTIZE_FORCE=on
>> and QUANTIZE_COLORS=256. I think I remember you saying somewhere that
>> reducing the number of colors mostly just reduced the pallet size and
>> that's pretty much what I see. e.g. reducing the pallet from 256 to 15
>> colors reduces the image size by about 15% in my lines and text test.
>>
>> Thanks all for the suggestions.
>> Rich
>>
>>
>> On Tue, May 18, 2021 at 11:49 AM Even Rouault 
>> wrote:
>>
>>> Forcing paletted images using QUANTIZE_FORCE=on and decreasing the number 
>>> of colors with QUANTIZE_COLORS can also help:
>>>
>>>  FORMATOPTION "QUANTIZE_FORCE=on"
>>>  FORMATOPTION "QUANTIZE_COLORS=200"
>>>
>>> Le 18/05/2021 à 19:30, Seth G a écrit :
>>>
>>> I've not used it but the following might help for the AGG/PNG driver:
>>>
>>> FORMATOPTION "COMPRESSION=9"
>>>
>>> https://mapserver.org/mapfile/outputformat.html
>>>
>>> The default is 6.
>>>
>>> --
>>> web:http://geographika.co.uk
>>> twitter: @geographika
>>>
>>>
>>> On Tue, May 18, 2021, at 7:16 PM, Basques, Bob (CI-StPaul) wrote:
>>>
>>> All,
>>>
>>>
>>>
>>> I know the GD stuff has been a long running conversation in the
>>> MapServer realm, but does this indicate that maybe discussing something on
>>> adding GD back in might be prudent?  Or are there methods to get down to
>>> these previous files sizes with the newer approaches?
>>>
>>>
>>>
>>> I have the same concerns related to image size from the performance
>>> side, and running on Mobile in our case.
>>>
>>>
>>>
>>> Bobb
>>>
>>>
>>>
>>>
>>>
>>> *From: *mapserver-users 
>>>  on behalf of Richard
>>> Greenwood  
>>> *Date: *Tuesday, May 18, 2021 at 11:50 AM
>>> *To: *"mapserver-users@lists.osgeo.org"
>>>  
>>> 
>>> *Subject: *[mapserver-users] anti-aliasing (was differing image size
>>> with different mapserver versions)
>>>
>>>
>>>
>>> *Think Before You Click: *This email originated *outside *our
>>> organization.
>>>
>>>
>>>
>>> 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
>>>
>>>
>>> ___
>>> mapserver-users mailing list
>>> mapserver-users@lists.osgeo.org
>>> https://lists.osgeo.org/mailman/listinfo/mapserver-users
>>>
>>>
>>>
>>> ___
>>> mapserver-users mailing 
>>> listmapserver-users@lists.osgeo.orghttps://lists.osgeo.org/mailman/listinfo/mapserver-users
>>>
>>> -- http://www.spatialys.com
>>> My software is free, but my time generally not.
>>>
>>> ___
>>> mapserver-users mailing list
>>> mapserver-users@lists.osgeo.org
>>> https://lists.osgeo.org/mailman/listinfo/mapserver-users
>>>
>>
>>
>> --
>> Richard W. Greenwood, PLS
>> www.greenwoodmap.com
>>
>
>
> --
> Richard W. Greenwood, PLS
> www.greenwoodmap.com
> ___
> mapserver-users mailing list
> mapserver-users@lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/mapserver-users
>
___
mapserver-users mailing list
mapserver-users@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/mapserver-users


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

2021-05-18 Thread Richard Greenwood
Oops - typo there, reducing the colors from 256 to *125* reduced the image
size by about 15%.

On Tue, May 18, 2021 at 12:11 PM Richard Greenwood <
richard.greenw...@gmail.com> wrote:

> Bob - I think GD was quite unpopular with the developers. Thomas Bonfort
> was pretty adamant about removing it. I'm hoping that there may be options
> in AGG.
>
> Seth - FORMATOPTION "COMPRESSION=9" only reduced the size by about 3% in
> my lines and text test case.
>
> Even - the default AGG/PNG8 has QUANTIZE_FORCE=on and QUANTIZE_COLORS=256.
> I think I remember you saying somewhere that reducing the number of colors
> mostly just reduced the pallet size and that's pretty much what I see. e.g.
> reducing the pallet from 256 to 15 colors reduces the image size by about
> 15% in my lines and text test.
>
> Thanks all for the suggestions.
> Rich
>
>
> On Tue, May 18, 2021 at 11:49 AM Even Rouault 
> wrote:
>
>> Forcing paletted images using QUANTIZE_FORCE=on and decreasing the number of 
>> colors with QUANTIZE_COLORS can also help:
>>
>>  FORMATOPTION "QUANTIZE_FORCE=on"
>>  FORMATOPTION "QUANTIZE_COLORS=200"
>>
>> Le 18/05/2021 à 19:30, Seth G a écrit :
>>
>> I've not used it but the following might help for the AGG/PNG driver:
>>
>> FORMATOPTION "COMPRESSION=9"
>>
>> https://mapserver.org/mapfile/outputformat.html
>>
>> The default is 6.
>>
>> --
>> web:http://geographika.co.uk
>> twitter: @geographika
>>
>>
>> On Tue, May 18, 2021, at 7:16 PM, Basques, Bob (CI-StPaul) wrote:
>>
>> All,
>>
>>
>>
>> I know the GD stuff has been a long running conversation in the MapServer
>> realm, but does this indicate that maybe discussing something on adding GD
>> back in might be prudent?  Or are there methods to get down to these
>> previous files sizes with the newer approaches?
>>
>>
>>
>> I have the same concerns related to image size from the performance side,
>> and running on Mobile in our case.
>>
>>
>>
>> Bobb
>>
>>
>>
>>
>>
>> *From: *mapserver-users 
>>  on behalf of Richard Greenwood
>>  
>> *Date: *Tuesday, May 18, 2021 at 11:50 AM
>> *To: *"mapserver-users@lists.osgeo.org" 
>>  
>> *Subject: *[mapserver-users] anti-aliasing (was differing image size
>> with different mapserver versions)
>>
>>
>>
>> *Think Before You Click: *This email originated *outside *our
>> organization.
>>
>>
>>
>> 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
>>
>>
>> ___
>> mapserver-users mailing list
>> mapserver-users@lists.osgeo.org
>> https://lists.osgeo.org/mailman/listinfo/mapserver-users
>>
>>
>>
>> ___
>> mapserver-users mailing 
>> listmapserver-users@lists.osgeo.orghttps://lists.osgeo.org/mailman/listinfo/mapserver-users
>>
>> -- http://www.spatialys.com
>> My software is free, but my time generally not.
>>
>> ___
>> mapserver-users mailing list
>> mapserver-users@lists.osgeo.org
>> https://lists.osgeo.org/mailman/listinfo/mapserver-users
>>
>
>
> --
> Richard W. Greenwood, PLS
> www.greenwoodmap.com
>


-- 
Richard W. Greenwood, PLS
www.greenwoodmap.com
___
mapserver-users mailing list
mapserver-users@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/mapserver-users


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

2021-05-18 Thread Richard Greenwood
Bob - I think GD was quite unpopular with the developers. Thomas Bonfort
was pretty adamant about removing it. I'm hoping that there may be options
in AGG.

Seth - FORMATOPTION "COMPRESSION=9" only reduced the size by about 3% in my
lines and text test case.

Even - the default AGG/PNG8 has QUANTIZE_FORCE=on and QUANTIZE_COLORS=256.
I think I remember you saying somewhere that reducing the number of colors
mostly just reduced the pallet size and that's pretty much what I see. e.g.
reducing the pallet from 256 to 15 colors reduces the image size by about
15% in my lines and text test.

Thanks all for the suggestions.
Rich


On Tue, May 18, 2021 at 11:49 AM Even Rouault 
wrote:

> Forcing paletted images using QUANTIZE_FORCE=on and decreasing the number of 
> colors with QUANTIZE_COLORS can also help:
>
>  FORMATOPTION "QUANTIZE_FORCE=on"
>  FORMATOPTION "QUANTIZE_COLORS=200"
>
> Le 18/05/2021 à 19:30, Seth G a écrit :
>
> I've not used it but the following might help for the AGG/PNG driver:
>
> FORMATOPTION "COMPRESSION=9"
>
> https://mapserver.org/mapfile/outputformat.html
>
> The default is 6.
>
> --
> web:http://geographika.co.uk
> twitter: @geographika
>
>
> On Tue, May 18, 2021, at 7:16 PM, Basques, Bob (CI-StPaul) wrote:
>
> All,
>
>
>
> I know the GD stuff has been a long running conversation in the MapServer
> realm, but does this indicate that maybe discussing something on adding GD
> back in might be prudent?  Or are there methods to get down to these
> previous files sizes with the newer approaches?
>
>
>
> I have the same concerns related to image size from the performance side,
> and running on Mobile in our case.
>
>
>
> Bobb
>
>
>
>
>
> *From: *mapserver-users 
>  on behalf of Richard Greenwood
>  
> *Date: *Tuesday, May 18, 2021 at 11:50 AM
> *To: *"mapserver-users@lists.osgeo.org" 
>  
> *Subject: *[mapserver-users] anti-aliasing (was differing image size with
> different mapserver versions)
>
>
>
> *Think Before You Click: *This email originated *outside *our
> organization.
>
>
>
> 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
>
>
> ___
> mapserver-users mailing list
> mapserver-users@lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/mapserver-users
>
>
>
> ___
> mapserver-users mailing 
> listmapserver-users@lists.osgeo.orghttps://lists.osgeo.org/mailman/listinfo/mapserver-users
>
> -- http://www.spatialys.com
> My software is free, but my time generally not.
>
> ___
> mapserver-users mailing list
> mapserver-users@lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/mapserver-users
>


-- 
Richard W. Greenwood, PLS
www.greenwoodmap.com
___
mapserver-users mailing list
mapserver-users@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/mapserver-users


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

2021-05-18 Thread Even Rouault

Forcing paletted images using QUANTIZE_FORCE=on and decreasing the number of 
colors with QUANTIZE_COLORS can also help:

 FORMATOPTION "QUANTIZE_FORCE=on"
 FORMATOPTION "QUANTIZE_COLORS=200"

Le 18/05/2021 à 19:30, Seth G a écrit :

I've not used it but the following might help for the AGG/PNG driver:

FORMATOPTION "COMPRESSION=9"

https://mapserver.org/mapfile/outputformat.html 
<https://mapserver.org/mapfile/outputformat.html>


The default is 6.

--
web:http://geographika.co.uk
twitter: @geographika


On Tue, May 18, 2021, at 7:16 PM, Basques, Bob (CI-StPaul) wrote:


All,


I know the GD stuff has been a long running conversation in the 
MapServer realm, but does this indicate that maybe discussing 
something on adding GD back in might be prudent?  Or are there 
methods to get down to these previous files sizes with the newer 
approaches?



I have the same concerns related to image size from the performance 
side, and running on Mobile in our case.



Bobb



*From: *mapserver-users  on 
behalf of Richard Greenwood 

*Date: *Tuesday, May 18, 2021 at 11:50 AM
*To: *"mapserver-users@lists.osgeo.org" 
*Subject: *[mapserver-users] anti-aliasing (was differing image size 
with different mapserver versions)



*Think Before You Click: *This email originated *outside *our 
organization.



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@lists.osgeo.org 
<mailto:mapserver-users%40lists.osgeo.org>
https://lists.osgeo.org/mailman/listinfo/mapserver-users 
<https://lists.osgeo.org/mailman/listinfo/mapserver-users>





___
mapserver-users mailing list
mapserver-users@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/mapserver-users


--
http://www.spatialys.com
My software is free, but my time generally not.

___
mapserver-users mailing list
mapserver-users@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/mapserver-users


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

2021-05-18 Thread Seth G
I've not used it but the following might help for the AGG/PNG driver:

FORMATOPTION "COMPRESSION=9"

https://mapserver.org/mapfile/outputformat.html

The default is 6. 

--
web:http://geographika.co.uk
twitter: @geographika


On Tue, May 18, 2021, at 7:16 PM, Basques, Bob (CI-StPaul) wrote:
> All,

>  

> I know the GD stuff has been a long running conversation in the MapServer 
> realm, but does this indicate that maybe discussing something on adding GD 
> back in might be prudent?  Or are there methods to get down to these previous 
> files sizes with the newer approaches?

>  

> I have the same concerns related to image size from the performance side, and 
> running on Mobile in our case.

>  

> Bobb

>  

>  

> *From: *mapserver-users  on behalf 
> of Richard Greenwood 
> *Date: *Tuesday, May 18, 2021 at 11:50 AM
> *To: *"mapserver-users@lists.osgeo.org" 
> *Subject: *[mapserver-users] anti-aliasing (was differing image size with 
> different mapserver versions)

>  

> *Think Before You Click: *This email originated *outside *our organization.

>  

> 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
> 

> ___
> mapserver-users mailing list
> mapserver-users@lists.osgeo.org <mailto:mapserver-users%40lists.osgeo.org>
> https://lists.osgeo.org/mailman/listinfo/mapserver-users
> 
___
mapserver-users mailing list
mapserver-users@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/mapserver-users


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

2021-05-18 Thread Basques, Bob (CI-StPaul)
All,

I know the GD stuff has been a long running conversation in the MapServer 
realm, but does this indicate that maybe discussing something on adding GD back 
in might be prudent?  Or are there methods to get down to these previous files 
sizes with the newer approaches?

I have the same concerns related to image size from the performance side, and 
running on Mobile in our case.

Bobb


From: mapserver-users  on behalf of 
Richard Greenwood 
Date: Tuesday, May 18, 2021 at 11:50 AM
To: "mapserver-users@lists.osgeo.org" 
Subject: [mapserver-users] anti-aliasing (was differing image size with 
different mapserver versions)

Think Before You Click: This email originated outside our organization.

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@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/mapserver-users


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

2021-05-18 Thread Richard Greenwood
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
).

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
___
mapserver-users mailing list
mapserver-users@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/mapserver-users