[mapserver-users] Force Mapserver into rendering 8bpp png images (instead of 4bpp)?

christian yrrman yrrman at gmail.com
Fri Apr 29 09:18:31 EDT 2011


Dear All,

former subject of this thread was "Re: NoDATA value, transparency for
paletted IMG file" -

I'm having difficulties displaying 4bit-per-pixel PNG images served
via WMS to a GoogleEarth-API-Application (the NoData-Values aren't
transparent but "shaded black", whereas this worls well for 8bpp PNG
images- so I assume the GE-API can't display transparency for 4bpp
PNGs.

Is there a way to force mapserver into the creation of 8bpp PNG files,
even if the corresponding color table only has 9 entries (I think
that's the reason for this)?

Thanks for your help and greetings!


Chris


On Thu, Apr 28, 2011 at 12:42 PM, ChrisFern [via OSGeo.org]
<ml-node+6312790-588073264-302786 at n2.nabble.com> wrote:
> Dear Frank, dear all,
>
> thanks for your reply.
> I think I have narrowed down the problem and it isn't really a mapserver
> issue - the 8bit paletted img gets rendered to a 4bit-per-pixel png whereas
> the correctly transparent RGB img gets rendered to an 8bit-per-pixel png.
> Seems that the Google Earth API can't detect/deal with the NoData value in
> this 4bpp png and renders this value sort of "shaded black" (which I would
> like to get ridd of). GIMP for example can deal with the transparency in
> this 4bpp png.
>
> If I switch to RGBA in the output format, then I have the transparency
> however the image is much bigger:
>
> OUTPUTFORMAT
>    NAME png
>    DRIVER "GD/PNG"
>    MIMETYPE "image/png"
> #   IMAGEMODE RGBA
>    IMAGEMODE PC256
>    EXTENSION "png"
>    TRANSPARENT ON
>    FORMATOPTION "transparent=on"
> END
>
> Is there a way I can force the mapserver to produce 8bpp pngs?
>
>
> THANKS for your help - highly appreciated - and greetings,
>
>
>
> Chris
>
> PS here's the gdalinfo output for the 4bpp png:
> Driver: PNG/Portable Network Graphics
> Files: lb_usa.png
> Size is 1024, 768
> Coordinate System is `'
> Corner Coordinates:
> Upper Left  (    0.0,    0.0)
> Lower Left  (    0.0,  768.0)
> Upper Right ( 1024.0,    0.0)
> Lower Right ( 1024.0,  768.0)
> Center      (  512.0,  384.0)
> Band 1 Block=1024x1 Type=Byte, ColorInterp=Palette
>   NoData Value=0
>   Image Structure Metadata:
>     NBITS=4
>   Color Table (RGB with 9 entries)
>     0: 1,1,1,0
>     1: 0,0,0,255
>     2: 12,16,120,255
>     3: 31,62,140,255
>     4: 33,110,158,255
>     5: 42,156,154,255
>     6: 61,184,104,255
>     7: 59,214,45,255
>     8: 113,235,47,255
>
> ________________________________
> If you reply to this email, your message will be added to the discussion
> below:
> http://osgeo-org.1803224.n2.nabble.com/NoDATA-value-transparency-for-paletted-IMG-file-tp6305135p6312790.html
> To unsubscribe from NoDATA value, transparency for paletted IMG file, click
> here.


More information about the mapserver-users mailing list