Scaling gray-levels in mapraster.c

Stephen Lime steve.lime at dnr.state.mn.us
Wed Sep 13 13:48:55 PDT 2000


Pete, thanks for the clarification. Support for GD-1.8, and hence PNG/JPEG
is due out later this week if I can clear up a few other issues that have popped
up this afternoon. However, GD is still limited to paletted images so there is
little reason to change much yet. No word on a full-blown new version of GD
with 24-bit output.

Steve

Stephen Lime
Internet Applications Analyst

Minnesota DNR
500 Lafayette Road
St. Paul, MN 55155
651-297-2937

>>> Pete Olson <pete at lmic.state.mn.us> 09/13/00 03:27PM >>>
Four bit images run from 0-15 and are scaled into an 8:8:8 color space
by multiplying by 17 giving black at 0:0:0 and white at 255:255:255. 
There is no 16.  The reasons are as Steve notes, to conserve colors for
other uses and limitations of the eye.  Some experts claim between 5 & 6
bit accuracy in the eye.  I have found that the USGS 1 meter doq data
doesn't benefit much, if at all, by using more bits.  I have seen other
data that does benefit more from an additional bit or two, notably some
of the satellite weather imagery, and also some more recent air photo
data.

The 256 color limitation was based on GIF file format and typical
display color resolution; perhaps neither are a constraint anymore
(Steve... Is PNG implemented? 24 bit?) and better greyscale resolution
should be added.

Pete Olson
Minnesota Land Management Information Center


Stephen Lime wrote:
> 
> I'm not sure about the upper 272 limit, but I know the rationale behind the
> resampling to 4-bit data has to do with the number of greyscale values
> the human eye can distinguish, which is 16. I've been working with a
> bunch of DOQ images and haven't noticed any degredation of output
> images due to the bining. It also saves valuable colors for annotation and
> feature rendering. I'm hoping the actual author of the TIFF code might
> have a bit more insight.
> 
> I can understand the use of BSQ images, but not your tiling implementation.
> MapServer already supports image tiliing, can you explain what you're up
> to?
> 
> Steve
> 
> Stephen Lime
> Internet Applications Analyst
> 
> Minnesota DNR
> 500 Lafayette Road
> St. Paul, MN 55155
> 651-297-2937
> 
> >>> Richard White <raw at essc.psu.edu> 09/13/00 01:58PM >>>
> All the drawXXX() functions in mapraster.c, when creating grey-level
> color tables, appear to rescale the values to run from 0 to 16*17 =
> 272.  Can you tell me the reason why?
> 
> The question has arisen while I'm trying to write a drawBSQ() function
> to incorporate support for aerial-photo type raster imagery into
> Mapserver, with the images in binary band-sequential (BSQ) format.
> Incidentally, since we want tiling, and the Arc/Info shape files aren't
> really intended to work with raster images, I've defined a simple raster
> tile specification file (giving filename, size, and extent of each tile
> file) which I access via a reinterpretation of "tileindex" and
> "tileitem" in the map file Layer object.
> 
>                                         Dick White
> 
> ========================================================================
>     Richard A. White
>     EMS Environment Institute
>     The Pennsylvania State University
>     2217 Earth-Engineering Sciences Bldg.
>     University Park, PA 16802-6813
> 
>     Tel. (814) 863-9540
> ========================================================================




More information about the MapServer-users mailing list