[mapserver-users] Mapserver 5.2.0 and 5.4.1, QUANTIZE_FORCEor PALETTE_FORCE do not produce8bit colour PNG file - onlyreduce the number of colours used.
Nikolai Nikolov
nnikolov at gypsii.com
Wed Jul 8 00:19:20 PDT 2009
Hi Steve, and everyone else,
Thanks for your responce!
Late last night I discovered what the issue was. It took me several days of
reading other people's problems and solutins in this area. It turned up
that it is not the Mapserver settings, but the PHP functions I use to save
the immage on the HD.
I am using PHP "imagepng" after cropping the original image to remove the
"gutter". However the function always seems to saves the image using 24
bits for colour mapping even if a palette is used and the colours are less
than 256.
The solution was to use "imagetruecolortopalette" PHP function like this -
imagetruecolortopalette($tile_image, false, 256)
I have to do some more investigation, but the PNG file now is using 8 bits
for colours and is dramaticaly amaller.
Best regards,
Nick
-----Original Message-----
From: Steve Lime [mailto:Steve.Lime at dnr.state.mn.us]
Sent: 07 July 2009 16:07
To: nnikolov at gypsii.com; mapserver-users at lists.osgeo.org
Subject: Re: [mapserver-users] Mapserver 5.2.0 and 5.4.1,QUANTIZE_FORCEor
PALETTE_FORCE do not produce8bit colour PNG file - onlyreduce the number of
colours used.
Hi Nikolai: I'm using the exact same output format and it works fine
for me (PALETTE_FORCE, 5.4.1). With that format my output images are
1/4 the size of their RGB counterparts. Have you tried a version without
any of the experimental PNG options enabled?
Steve
>>> "Nikolai Nikolov" <nnikolov at gypsii.com> 07/07/09 6:48 AM >>>
Hi everybody,
I have tried unsuccessfully to reduce the size of my PNG image tiles,
generated by the Mapserver using the QUANTIZE_FORCE or PALETTE_FORCE
options. The resulting file is marginally smaller than the one not using
those options.
Using "IrfanView" I could get some information about the colours used and
the number of bits used to code the colours. The repost shows a decrease of
the number of colours used from over 1600 to either 241 (Mapserver defined)
or 193 (using palette file containing 71 predefined colours).
However, tool reports 24 bits used for colour mapping.
If I put the PNG image through tools like "pngquant", "OptiPng" or
"pngcrush", the resulting image is much smaller and "IrfanView" reports that
only 8 bits are used for colour mapping!
The relevant map file part is:
IMAGETYPE AGG_PNG24
OUTPUTFORMAT
NAME AGG_PNG24
DRIVER AGG/PNG
MIMETYPE "image/png"
IMAGEMODE RGB
EXTENSION "png"
FORMATOPTION "PALETTE_FORCE=TRUE"
FORMATOPTION "PALETTE=/var/www/html/maps_gypsii/palette.txt"
FORMATOPTION "INTERLACE=OFF"
END
The Mapserver, both 5.2.0 and 5.4.1, has been configured with
--with-experimental-png or --enable-experimental-png (I have not noticed any
difference in using either option).
Please, advise what I am missing here.
Many thanks,
Nick
More information about the MapServer-users
mailing list