continued heartburn over r.in.tiff

Steve Franklin franklin at ug.cs.dal.ca
Sun Jun 19 07:57:59 EDT 1994


Progress:

What are we doing to import our images now? Well, we do not use r.in.sunrast,
nor do we use r.in.tiff...
   We have a program which is generating the images, and we now make it
generate a simple binary file, that is 256*256*8 (x*y*color_depth where
color_depth is 8 bits). This file can be placed directly in the cell
directory. Then, all you have to do is update it's appropriate files, which
are in the cellhd, colr, range, and other directories (everything but the
digitized directories). We have chosen to do this automatically, rather than
run r.support which achieves the exact same goal. 
   Since we are working with greyscale, we then have to rescale the map
colors from 0:255 to 0:210, and run the monitor in d.colormode mode=float,
giving us a full range of greyscales to work with.
   You can also get rid of the r.in.sunrast problem if you have the raster
files created by xv, rather than pnmtorast (from the pbmplus utilities).
Someone described a blank screen after converting in xv then importing, and
I must say I've never seen this before. Make sure you've got the latest xv
version (binaries are precompiled and available from ftp.uni-stuttgart.edu,
in the /sw section, although I would suggest recompiling it myself - it's
nice to compile it with libtiff so that it can handle tiffs nicely).
   You may be asking yourself "How the heck do I get it into that generic
binary format that you described? (256*256*8)?. Well, if you can get the
file into a pnm format, then you're there. You see, a pnm rawbits file is
just the following:

P5
256 256
255
binary data...
binary data...
etc...

So, if you strip the first 3 lines of the file, you can have your basic
binary image. Moreoever, you can automate the task as we have by strippin
the important information from the header. P5 is garbage, 256 256 means that
you have 256 x cols, 256 y cols. 255 means that you've got 255 colors (8
bit, or 1 byte of color depth. I think grass wants the 1 byte mentioned).
Then, you import it as I have mentioned, and it should work fine.

   Hoping you have good luck, and welcoming you to give me a shout with more
questions,

Steve Franklin
-- 



More information about the grass-user mailing list