[mapserver-dev] OUTPUTFORMAT with AGG and IMAGEMODE PC256?

thomas bonfort thomas.bonfort at gmail.com
Tue Aug 12 12:01:59 EDT 2008


you have to use IMAGEMODE RGB, although the formatoptions you can
apply will create the equivalent of a pc256 image.

instead of the palette options you gave, there's also
FORMATOPTION "QUANTIZE_FORCE=TRUE"
FORMATOPTION "QUANTIZE_COLORS=256"

which will have the "best" 256 colors retained to create the pc256
image (note that original (ie mapfile) colors aren't kept, so you
can't do tiling with this as adjacent tiles aren't guaranteed to have
the same color for a given feature).

an intermediate method is to use a palette, in which you only specify
the colors you want to keep (with some scripting magic involving a
`grep -i color mapfile.map`). the 256 - n remaining colors will be
automatically computed, insuring seamless tiles *and* best-fit colors.

thomas


On Tue, Aug 12, 2008 at 4:39 PM, Daniel Morissette
<dmorissette at mapgears.com> wrote:
> Dev's,
>
> Is there a way that we could allow the use of IMAGETYPE PC256 with the
> AGG/PNG driver, in the interest of reducing the size of the output images?
> i.e. an OUTPUTFORMAT like this:
>
> OUTPUTFORMAT
>    NAME                  "png"
>    DRIVER                "AGG/PNG"
>    MIMETYPE              "image/png"
>    IMAGEMODE             "PC256"
>    EXTENSION             "png"
>    FORMATOPTION          "PALETTE_FORCE=TRUE"
>    FORMATOPTION          "PALETTE=/path/to/palette.txt"
>    FORMATOPTION          "INTERLACE=OFF"
> END
>
> I realize that AGG requires RGB buffers internally to do its antialiasing,
> but could we not post-process the image to convert it from the internal RGB
> representation to PC256 before generating the output? With a very simple
> test that I made, producing the same (very simple) map in PC256 mode instead
> of RGB makes it pass from 38kb to 5kb... that is quite a gain, well worth
> the extra CPU time.
>
> Or is this possible already and if yes what is the OUTPUTFORMAT definition
> to use?
>
> Thanks
>
> Daniel
> --
> Daniel Morissette
> http://www.mapgears.com/
> _______________________________________________
> mapserver-dev mailing list
> mapserver-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/mapserver-dev
>


More information about the mapserver-dev mailing list