more: binary file into GRASS

BAKERWL at uwyo.edu BAKERWL at uwyo.edu
Tue May 23 08:00:00 EDT 1995


So far with help from the list, I have the following procedure, which
does work:

        In xv, save the image as PBM (raw) with "Save at normal size"
option after converting the image to 8-bit.  I used "Full color" option,
but it may be that "Reduced Color" will be needed.

        If the saved file is file.ppm, then the unix "tail" command
will strip off the first 4 lines of ASCII text that xv puts on the 
beginning of the binary file:

                tail +5 file.ppm > filebinary.ppm

        I then put the filebinary.ppm file in the cell subdirectory
of an "xy" location and mapset.  Then I run r.support:
                Edit the header...enter rows, cols, and 3 bytes per
                        cell.
                Update the stats...
                skip Editing the category file...
                skip Create/Update the color table...this could be
                        wrong?
                skip Edit the history file...

        Then, I g.region rast=filebinary.ppm and display the map
with d.rast.

The map displays correctly aligned and at the right resolution, BUT
the color table is not the same as in xv.  It doesn't matter if I
set d.colormode to float first, the color table is still wrong.
This is particularly troublesome when the image is a scanned aerial
photo (as in my case) where the colors have particular meaning.

I suspect that this mismatch in color tables is because GRASS 
reserves some of the 256 colors for vector overlays.  But, the
question still is how to work around this to go from a good color
representation of an aerial photo in xv to a similarly good 
color representation in GRASS?

I did try starting xv with a -nc 216 option, which is supposed to
limit the number of colors xv uses to 216, but this did not seem
to change the resulting image when brought into GRASS as a binary
file.  

Bill Baker
bakerwl at uwyo.edu





More information about the grass-user mailing list