how to input binary image into GRASS

Bill Brown brown at gis.uiuc.edu
Tue May 23 08:00:00 EDT 1995


If you save an image from xv in Greyscale PBM (pgm) format,
the first few lines are row-column & format information, etc.  Then
a single line of 8 bit characters are written to represent the
image.  So the command "tail -1 file.pgm > mapname" will generate
an 8 bit map suitable for placing in your "cell" directory.
"head -3 file.pgm" will show you the dimensions of the image;
on one line there will be two numbers - the first is columns, the 
second is rows.  You can use these to create a cellhd file, then
run r.support to generate a color file.  I don't know how to preserve
the original color table - I think this method would only be useful
to import data that is already mapped to color value (dark->light).
To get color data, I think you still need to use one of the tiff, gif,
or ppm import routines.  (take a look at r.in.ppm in
src.contrib/SCS/raster/r.ppm)

- Bill B.








More information about the grass-user mailing list