[mapserver-users] File size of generated PNG

SQ9MEV groups at sq9mev.info
Sat Jun 9 22:58:07 PDT 2012


On 09.06.2012 10:08, Rahkonen Jukka wrote:
> Hi,
>
> Have you already tried quantize and compression options from http://www.mapserver.org/mapfile/outputformat.html? The "png8" example is a good starting point.
>
> How does your current png outputformat look?

I've faced this problem some time ago - i wanted fancy transparent 
tiles. The solution was to use paletted PNG:


   OUTPUTFORMAT
     NAME "png"
     DRIVER AGG/PNG
     IMAGEMODE RGBA
     FORMATOPTION "PALETTE_FORCE=TRUE"
     FORMATOPTION "PALETTE=/[...]/palette.txt"
     INCLUDE "palette.map"
     FORMATOPTION "INTERLACE=OFF"
   END

That decreased non empty file size from avrerage ~13KB to 2..3kB, empty 
pngs are bigger ofcourse (AFAIR 1.8KB paletted vs 332B not paletted).

I use custom django views using some parts of tilecache - tilecache must 
be patched to use transaprency in palette:
https://github.com/sq9mev/TileCache/commit/cd718fae9d8da01673c842b0b89226bb8ba4697f

And you have to use development version of PIL:
https://bitbucket.org/effbot/pil-2009-raclette

And you need to prepare your palette as well.

-- 
Regards
Bartek



More information about the mapserver-users mailing list