<div dir="ltr"><div>Worth adding to main?</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, May 19, 2021 at 10:15 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">If you want to give Cairo a try, you could modify mapcairo.c like this:<br>
<br>
diff --git a/mapcairo.c b/mapcairo.c<br>
index 0f4cc094..d28947d6 100644<br>
--- a/mapcairo.c<br>
+++ b/mapcairo.c<br>
@@ -517,6 +517,12 @@ imageObj* createImageCairo(int width, int height, outputFormatObj *format,colorO<br>
<br>
     cairo_set_line_cap (r->cr,CAIRO_LINE_CAP_ROUND);<br>
     cairo_set_line_join(r->cr,CAIRO_LINE_JOIN_ROUND);<br>
+    {<br>
+        const char* antialias = msGetOutputFormatOption(format, "ANTIALIAS", "TRUE");<br>
+        if (EQUAL(antialias, "OFF") || EQUAL(antialias, "FALSE") || EQUAL(antialias, "0")) {<br>
+            cairo_set_antialias(r->cr, CAIRO_ANTIALIAS_NONE);<br>
+        }<br>
+    }<br>
     image->img.plugin = (void*)r;<br>
   } else {<br>
     msSetError(MS_RENDERERERR, "Cannot create cairo image of size %dx%d.",<br>
<br>
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:<br>
<br>
 OUTPUTFORMAT<br>
   NAME "cairopng"<br>
   DRIVER CAIRO/PNG<br>
   MIMETYPE "image/png"<br>
   IMAGEMODE RGB<br>
   EXTENSION "png"<br>
   FORMATOPTION "ANTIALIAS=FALSE"<br>
   FORMATOPTION "QUANTIZE_FORCE=ON"<br>
   FORMATOPTION "QUANTIZE_COLORS=256"<br>
   FORMATOPTION "COMPRESSION=9"<br>
 END<br>
<br>
I used the msautotest/renderers/line_simple.map example to test and that crushed the resulting png from 5920 bytes down to 947 bytes. <br>
<br>
HTH, Andreas<br><br>
</blockquote></div></div>