forced palette for RGBA images

thomas bonfort thomas.bonfort at GMAIL.COM
Thu Dec 6 11:07:55 EST 2007

hello list,

I've added the possiblity to force a color palette for RGBA images. As
gd does not support this kind of images, I had to resort to directly
use libpng functions for the actual saving of the file.

The steps needed to actually use this would be:
- create a 24 bit rgba image representative of a typical image that
would be produced
- use an external program to create an rgba paletted version of the
image (pngquant, pngnq, photoshop...)
- extract the palette from the created image and save the values in
the form r,g,b,a in a text file (one per line)
- use palette_force and palette formatoptions in the outputformat block.

This is rather complicated, but usefull on production setups to
minimize image size when using clients that overlay layers (eg

There are still a few quirks I'd have to work on before the code is
robust enough for inclusion in the trunk, so I'd like to know if this
is a feature we'd definitely like to have before putting too much
effort into that.


More information about the mapserver-dev mailing list