[mapserver-users] Using a 16-bit per band PNG image

Frank Warmerdam warmerdam at pobox.com
Tue Mar 17 09:52:01 EDT 2009


Reinoud Bokhorst wrote:
> Hi,
> I am trying to use a PNG image with 16-bits per color band (TYPE=UInt16 
> according to GDAL) as a raster layer in mapserver. But what comes out is 
> reduced to a 8-bit per color band PNG (TYPE=BYTE) resulting in a loss of 
> colors.

Reinoud,

MapServer does not normally support more than 8bit per band output.
If you need 16bit color resolution per color band you are pretty much
out of luck.

> I tried various imagetype options like aggpng24, png24 and my own 
> outputformat definitions with imagemode RGB, RGBA and INT16 but all gave 
> the same result.
> 
> It seems that I should be using INT16 but mapserv crashes on it. Apache 
> log file only shows "Premature end of script headers: mapserv". Also the 
> documentation mentions "No presentation" for the INT16 option: what does 
> that mean?

INT16 is primarily meant for pure-raster rendering for things like WCS
that need to preserve the original raster pixel values exactly rather
than producing a presentation oriented result.  I am concerned about the
crash.  I would appreciate your filing a ticket with details on reproducing
this problem.

In theory you should be able to achieve 16bit per color band output if
you use INT16, an output format that is based on GDAL with a 16bit supporting
format like PNG or GeoTIFF.  But keep in mind you cannot render any
non-raster results into such an output format.  The BYTE, INT16, and FLOAT32
output formats are only supported by the raster layer renderer (as noted -
primarily aimed at WCS).

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