[mapserver-users] NoDATA value, transparency for paletted IMG file

2011-04-26 Thread ChrisFern
Dear All,

I'm trying to figure out how to set the OFFSITE value for an 8bit paletted
img file - I've been searching the archive for quite some time now but
couldn't find an answer :(

I got the following gdalinfo:

Driver: HFA/Erdas Imagine Images (.img)
[..]
Coordinate System is:
GEOGCS["GCS_WGS_1984",
DATUM["WGS_1984",
SPHEROID["WGS_1984",6378137.0,298.257223563]],
PRIMEM["Greenwich",0.0],
UNIT["Degree",0.017453292519943295]]
[..]
Band 1 Block=64x64 Type=Byte, ColorInterp=Palette
[..]
  NoData Value=0
  Overviews: 7197x7624, 3599x3812, 1800x1906, 900x953, 450x477, 225x239
  Metadata:
[..]  Color Table (RGB with 256 entries)
0: 0,0,0,255
1: 0,0,0,0
2: 0,0,0,0
3: 113,235,47,255
[..]



so the NoData Value corresponds to index 0, with rgb 0,0,0 and opacity 255.


In the mapfile I tried both

OFFSITE 0,0,0 
and
PROCESSING "NoData=0"

which didn't work. "OFFSITE 0", as one could expect, doesn't work either
(generates an error). My output format is 

OUTPUTFORMAT
   NAME png
   DRIVER "GD/PNG"
   MIMETYPE "image/png"
#   IMAGEMODE RGBA
   IMAGEMODE PC256
   EXTENSION "png"
   TRANSPARENT ON
   FORMATOPTION "transparent=on"
END

With my other RGB-Layers with 3bands the above setting works well, we're
overlaying these WMS layers in the Google Earth API (browser plugin) using
the function "ge.createGroundOverlay".


We're using
MapServer version 5.4.1 OUTPUT=GIF OUTPUT=PNG OUTPUT=JPEG OUTPUT=WBMP
OUTPUT=SVG SUPPORTS=PROJ SUPPORTS=FREETYPE SUPPORTS=ICONV
SUPPORTS=WMS_SERVER SUPPORTS=WMS_CLIENT SUPPORTS=THREADS SUPPORTS=GEOS
INPUT=TIFF INPUT=EPPL7 INPUT=POSTGIS INPUT=OGR INPUT=GDAL INPUT=SHAPEFILE

Any idea/clues what might be wrong here? Help is highly appreciated.

Thanks and advance and greetings, 


Chris


--
View this message in context: 
http://osgeo-org.1803224.n2.nabble.com/NoDATA-value-transparency-for-paletted-IMG-file-tp6305135p6305135.html
Sent from the Mapserver - User mailing list archive at Nabble.com.
___
mapserver-users mailing list
mapserver-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users


[mapserver-users] Re: NoDATA value, transparency for paletted IMG file

2011-04-28 Thread ChrisFern
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

--
View this message in context: 
http://osgeo-org.1803224.n2.nabble.com/NoDATA-value-transparency-for-paletted-IMG-file-tp6305135p6312790.html
Sent from the Mapserver - User mailing list archive at Nabble.com.
___
mapserver-users mailing list
mapserver-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users