[mapserver-users] Howto generate 24-bit png data from mapscript

Sven Geggus lists at fuchsschwanzdomain.de
Tue May 6 01:59:13 PDT 2008


Hi there,

looks like I got bitten by some mapscript bug, because I am unable to produce
24-bit png output via mapscript from my raster layers. I always get 8-bit
rasters :(

Despite the bug, I need a workaround for this as 8-bit rasters are
insufficient for my purpose.

Here is what my current testscript looks like:

--cut--
import mapscript

def index(req):
req = mapscript.OWSRequest()
req.loadParams() 

map = mapscript.mapObj()
map.name = "TestMap"
map.shapepath = "/path/to/orthoimage/"
map.setProjection("init=epsg:4326")
map.setMetaData("wms_srs","epsg:4326")
map.setExtent(-180.0,-90.0,180.0,90.0)

outputFormat=mapscript.outputFormatObj("GD/PNG")
outputFormat.name="png"
outputFormat.setMimetype("image/png")
outputFormat.imagemode=mapscript.MS_IMAGEMODE_RGBA
outputFormat.transparent=1
outputFormat.setExtension("png")
map.setOutputFormat(outputFormat)
    
layer = mapscript.layerObj(map)
layer.name= "foobar"
layer.type = mapscript.MS_LAYER_RASTER
layer.status = mapscript.MS_DEFAULT
layer.data = "my_otho_image.img"

map.save("/tmp/buggy.map")

map.OWSDispatch(req)
--cut--

Do you know a suitable workaround for this Problem?

I consider this as a bug, because I am able to produce perfect 24-bit png
data when using the genearted mapfile from cgi-mapserv.

Regards

Sven

P.S.: I already reported this, but did not get a responce
https://trac.osgeo.org/mapserver/ticket/2587

-- 
Threading is a performance hack.
(The Art of Unix Programming by Eric S. Raymond)

/me is giggls at ircnet, http://sven.gegg.us/ on the Web



More information about the MapServer-users mailing list