[Chameleon] How to specify 24bit output for a WMS layer within an xml context file?

Jennifer Zeisloft jzeisloft at gmail.com
Tue Jan 24 01:00:37 EST 2006

Hello All,

I have been having problems displaying raster imagery from web mapping
services in MapServer/Chameleon (poor visual resolution, essentially).  I
first sought help from the MapServer list (pasted below), but have
discovered that I likely need Chameleon help.

Specifically, I am wondering how I can specify that 24bit output be
generated from a layer in a web mapping context.

In addition to the responses below, Frank Warmerdam also suggested adding
PROCESSING "DITHER=YES" to the mapfile if I do not specify jpeg or png24 in
the mapfile output.  This did help somewhat.  But again, the problem is that
I cannot refer to a mapfile in an xml context file (as far as I know).  So,
there must be some other means in Chameleon of specifying that the output is
24bit rather than 8bit.

I am grateful for any hints or ideas you can offer!


Jennifer Zeisloft
UW Sea Grant

>From the MapServer List Discussion:

Greetings All,

We have been noticing that some (but not all) WMS raster images look pretty
terrible (extremely low resolution compared to what they should be) when
added to our MapServer application.  For instance, from TerraServer (
http://terraservice.net/ogcmap.ashx), USGS Digital Ortho Quads are virtually
useless regardless of scale, while USGS DRGs look decent.  Daily MODIS
imagery from NASA JPL World Map Service (http://wms.jpl.nasa.gov/wms.cgi?)
has also typically been a problem.  And there are others...

I have recently been playing with GDAL to display our own rasters, but also
partially with the hope that it might somehow magically fix this problem (of
course it hasn't).

I am wondering whether the display problem is local or if it is on the data
custodian's end, and whether this is typically the case.  Is there any way
to correct it?  If it is at the custodial end, what might be done
differently to increase the display resolution for WMS clients (so that we
don't make the same mistake)?

I really appreciate any hints or ideas you can offer.

Thanks much!

Jennifer Zeisloft
UW Sea Grant

Jennifer -

You don't give us much information to go on, other than your dislike of the

If you're consistently seeing poor-quality results, then there may well be
something systematic you're doing in your map files or MapServer
configuration.  I'm assuming you're using MapServer to generate these
"horrible-looking" images.  If you are, for example, requesting low-color
output from high-color images, you're going to see blotchy output.  DRGs are
low-color images (only 13 unique colors) so they are not as prone to being
affected by a low-color output request.

Could you provide an example of the map file and configuration you're using
to retrieve and display these images?  There's nothing special about the WMS
interface that inherently limits image quality - you can get a perfect
reproduction of the source imagery in many cases.

    - Ed

Ed McNierney
President and Chief Mapmaker
TopoZone.com / Maps a la carte, Inc.
73 Princeton Street, Suite 305
North Chelmsford, MA  01863
Phone: +1 (978) 251-4242
Fax: +1 (978) 251-1396
ed at topozone.com

Thank you for responding, Ed.

Actually, these raster data sets are displayed as part of Chameleon contexts
(so there is no mapfile).  I added the USGS orthos to a mapfile to see if
the result was any different and it wasn't (the mapfile code for this layer
is pasted below in any case).

The application can be found at
http://maps.aqua.wisc.edu/lscmp/viewmaps.phtml.  The example data sets I am
referring to can be found in the Wisconsin: Imagery context.

I have read through the documentation on rasters in MapServer, as well as
searched list archives and have not been able to determine how I would go
about specifying low or high -color output.  So, perhaps this is part of the

Again, any suggestions are greatly appreciated!!

Jennifer Zeisloft

  CONNECTION "http://terraservice.net/ogcmap.ashx"
  END # Projection
   "wms_srs"             "EPSG:4326"
   "wms_name"            "DOQ"
   "wms_title"           "USGS Digital Ortho-Quadrangles"
   "wms_onlineresource"  "http://terraservice.net/ogcmap.ashx"
   "wms_abstract"        "NA - test"
   "wms_keywordlist"     "NA -test"
   "wms_server_version"  "1.1.1"
   "wms_formatlist"      "image/png,image/jpeg,image/wbmp"
   "wms_format"          "image/png"
  END # Metadata
END # layer

From: Frank Warmerdam <warmerdam at pobox.com>    Mailed-By: lists.umn.edu
Reply-To: Frank Warmerdam <warmerdam at pobox.com>
To: MAPSERVER-USERS at lists.umn.edu
Date: Jan 23, 2006 10:57 PM
Subject: Re: [UMN_MAPSERVER-USERS] Horrible Looking WMS Raster Imagery

On 1/23/06, Brent Pedersen <bpederse at nature.berkeley.edu> wrote:
> have you tried using image/jpeg?

In addition to fetching data from the remote WMSes as
JPEG, it is also necessary for mapserver to generate 24bit
output (JPEG or PNG24 for instance).  I don't know how to
do that with Chameleon myself, but I'm sure there is a setting

I think Ed is right that the problem is 24bit to 8bit color
conversion with correspondingly poor color resolution.
Given sufficient blotchiness from this conversion it can
even appear that spatial resolution is degraded (though it
isn't actually).

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


Thanks for the suggestion.  I switched the output from png to jpeg - but no
change (the jpeg might have looked a little worse??).  Still, the crux of
the matter is, I suppose, that these images are displayed through a context
file.  The rasters are coming straight from their "original" (perhaps)
source, which doesn't allow me to specify how the image is displayed, but
merely that an image is displayed (furthermore, the context file is
automatically generated by the "Save Context" widget in Chameleon).

And an addendum to my last message:  I did find output specifications in the
documentation (
http://mapserver.gis.umn.edu/docs/reference/mapfile/outputformat/), but I
don't have the opportunity in this instance to specify the output in this


Hi Frank,

Thanks for the response, Frank.  It is sounding more and more like this is a
question I ought to forward to the chameleon list - because I am also not
sure how to generate 24bit output with chameleon!

I appreciate the much needed direction!

Thanks all!

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.maptools.org/pipermail/chameleon/attachments/20060124/f99be5d4/attachment.html

More information about the Chameleon mailing list