Why do my JPEG input images not look right via MapServer?
Up to table of contentsI have a nice 24bit color jpeg image but when I add
it as a raster layer in MapServer, the colors looks
crappy! Why is that?
The default output format for MapServer is 8bit pseudo-colored PNG or GIF. Inherently there will be some color degredation in converting a 24bit image (16 million colors) image into 8bit (256 colors).
But in order to ensure fast rendering MapServer uses quite a simple method to do the transformation, converting pixels to the nearest color in a 175 color colorcube. This will usually result in blotchy color in a fairly smoothly varying image.
- Solutions include:
- Select 24bit output. This might be as easy as "IMAGETYPE JPEG" in your MAP section.
- Enable dithering (PROCESSING "DITHER=YES") to produce a better color appearance.
- Preprocess your image to 8bit before using it in MapServer with an external application like the GDAL rgb2pct.py script.
For more information review the Raster HOWTO document.
This FAQ applies to: MapServer 4.6, MapServer 4.8