Enabling Quantization Support
From Ka-Map Wiki
Quantization describes the process of reducing the number of colours used in an image. MapServer supports quantization of 24 bit PNG images through a FORMATOPTION in the OUTPUTFORMAT object of a map file. Quantization is important to reduce file size. In some cases it is desirable or necessary to work with true colour (24 bit) images. For instance, if you have enabled antialiased lines, antialiased fonts, or work with imagery, you probably will find that MapServer corrupts the colour table of 8 bit output formats such as GIF and PNG and have already switched to 24 bit PNG output. For optimal ka-Map performace, you should try to use the smallest possible images. In many cases, quantizing a 24 bit image to 256 colours (8 bit) results in a visually identical image AND smaller file size (by a factor of about 4 in my experience.
To enable Quanitization support in ka-Map, you need to do the following:
- ensure you have MapServer 4.9 CVS as of 2006-03-08 or later release
- ensure you have ka-Map CVS as of 2006-03-22 or release 0.3 or later
- add the following output format object to your map file
OUTPUTFORMAT NAME png8_t DRIVER "GD/PNG" EXTENSION "png" MIMETYPE "image/png" IMAGEMODE RGBA TRANSPARENT OFF FORMATOPTION "QUANTIZE_FORCE=ON" FORMATOPTION "QUANTIZE_DITHER=OFF" FORMATOPTION "QUANTIZE_COLORS=10" END
- change the 'format' option in config.php for you map file to 'dithered'
- make sure that you have an up-to-date config.php that supports 'dithered' by checking the setOutputFormat function and ensuring that it has a 'dithered' case. If not, grab this function from config.dist.php