Increase Clarity of WMS
Frank Warmerdam
warmerdam at POBOX.COM
Fri Apr 7 19:49:48 PDT 2006
Clint Johnson wrote:
> Kyle,
>
> Your error is due to the line that says
> PROCESSING "RESAMPLE=AVERAGE"
>
> If you want a quality image then by all means do NOT use average dithering.
> example of average dithering
> http://www.visgraf.impa.br/Courses/ip00/proj/Dithering1/average_dithering.html
>
>
> Use one of:
>
> PROCESSING "RESAMPLE=BILINEAR"
> PROCESSING "RESAMPLE=BICUBIC" # preferable
Clint / Kyle,
Note that RESAMPLE=BICUBIC was never actually implemented.
I also I believe it is wrong to talk about average dithering. The
resampling/averaging work is done in a separate step from dithering.
Dithering is only applied when converting 24bit imagery to 8bit
pseudocolored output. I *think* in Kyle's case he has the dither
request in the layer but it won't be used because he is producing
24bit (jpeg?) output. But this is from a vague recollection.
> Stay away from nearest and average.
>
> Without having to go into Digital processing 101, using nearest or
> average will cause your image to "chunk" when it is re-sampled (ie
> zoomed in or out); whereas, bilinear and bicublic will give it a nice
> "anti-aliased" look as you zoom in.
If you are decimating by a significant factor for a "line work" image
I would claim that averaging gives a nice anti-aliased effect. The problem
with the resampling kernels is that with heavy resampling it is hit or miss
whether thin lines will end up contributing at all to the output pixel.
For instance imagine we are requesting an image at 1/16 it's original
resolution. So for each map pixel there is a 16x16 region on the original
image to sample from. Bilinear will compute an output pixel value from
some 2x2 portion of that 16x16 area, and depending on where the "sample"
request falls it can easily be only one pixel giving the majority of
the contribution. With linework, or thin text it is easy for output pixels
that include the line or text to have absolutely no contribution from the
line/text. Averaging (as done in MapServer) at least ensures a grey
level for the output pixel in proportion to how much of the input
region that represents is touched by lines/text.
Some example output is at:
http://home.gdal.org/~warmerda/resample/
I'm afraid I haven't dug into Kyle's problems in great detail, since I
haven't really seen any convincing demonstration that there is a bug.
I find discussions of "quality" are very subjective and after I stare at
the pixels for too long I lose all ability to make meaningful judgements.
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 | President OSGF, http://osgeo.org
More information about the MapServer-users
mailing list