[Mapserver-users] HOWTO: 24 bit png on WMS interface

Frank Warmerdam warmerdam at pobox.com
Tue Jan 27 15:33:28 EST 2004


Norman Vine wrote:
> Bart van den Eijnden writes:
> 
>>thanks to Frank Warmerdam I have solved my problem with not getting 24 bit 
>>PNG output in Mapserver.
>>
>>In my MAP file I used the following:
>>
>>IMAGETYPE PNG24
>>
>>and then in my WMS request I used format=image/png
>>
>>This caused 8-bit PNG to be generated instead of 24-bit PNG.
>>
>>The solution Frank suggested is using the following OUTPUTFORMAT in my MAP 
>>file and this works:
>>
>>OUTPUTFORMAT
>>   NAME PNG24
>>   DRIVER "GD/PNG"
>>   MIMETYPE "image/png"
>>   EXTENSION PNG
>>   IMAGEMODE RGBA
>>   TRANSPARENT ON
>>END
>>
>>Maybe something for the Mapserver WMS HOWTO?
> 
> 
> see
> http://mapserver.gis.umn.edu/doc/mapfile-reference.html#outputformat

Norman,

The subtle bit here is that Bart was already selecting the format he wanted
in the .map file with an IMAGETYPE PNG24 line.  The problem was that this gets
overridden by the FORMAT=image/png item in the WMS request.  This causes the
whole list of built-in output formats to be scanned, and the first select
which happens to be the 8bit png.

The added value in explicitly declaring the OUTPUTFORMAT PNG24 in the .map
file is that this causes it to be ahead of all the default output format
declarations in the internal list, and so it gets selected in preference
to the 8bit PNG format declaration.

So things to remember are:

  o The WMS FORMAT= overrides the IMAGETYPE you specify in your .map file.
  o Requested formats are selected based on a first match is used criteria.
  o The .map file can be effectively used to control the order of output
    formats.

Best regards,

-- 
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | Geospatial Programmer for Rent





More information about the mapserver-users mailing list