[mapserver-users] PNG Optimization

Ivan Mincik ivan.mincik at gmail.com
Thu Dec 16 13:01:58 PST 2010


2010/12/10 Cédric MOULLET <cedric.moullet at gmail.com>:
> Hi,
> We are using MapServer to generate tiles and the following ouptut format is
> used:
>
> OUTPUTFORMAT
>  NAME "pnga"
>  MIMETYPE "image/pnga"
>  DRIVER "AGG/PNG"
>  EXTENSION "png"
>  IMAGEMODE "RGBA"
>  TRANSPARENT TRUE
>  FORMATOPTION "INTERLACE=OFF"
> END
>
> We observe that the size of the tiles can be reduced by a at least factor 2
> if we use a tool like optipng.
> Is it possible to configure MapServer in order to optimize the file output
> (and for example use optipng)  ? Or do you see another way to optimize the
> image (I'd like to do that on the MapServer side in order to avoid a
> postprocessing) ?
> Thanks in advance for any hints.
> Cédric

Hi Cedric,
when You compile Your Mapserver with "–with-experimental-png" option
You can have very nice quantized PNG images, which can be much more
smaller. We are using this option for all our projects for few years
now.

Configuration example:

        IMAGETYPE 'AGG_PNG'
	OUTPUTFORMAT
		NAME 'AGG_PNG'
		DRIVER 'AGG/PNG'
		MIMETYPE 'image/png'
		IMAGEMODE RGBA
		FORMATOPTION 'QUANTIZE_FORCE=ON'
		FORMATOPTION 'QUANTIZE_DITHER=OFF'
		FORMATOPTION 'QUANTIZE_COLORS=256'
		FORMATOPTION 'INTERLACE=OFF'
		EXTENSION 'png'
	END

More here: http://mapserver.org/mapfile/outputformat.html

Ivan



More information about the MapServer-users mailing list