[GRASSLIST:2807] Re: r.in.tiff

ulf at mail.zmt.uni-bremen.de ulf at mail.zmt.uni-bremen.de
Wed Dec 19 13:12:24 EST 2001


Many thanks for answering my question! I finally made a two-line Perl
script to remove the header and imported the original data. The
information about "colour depth" of the grey scale images came from
Gimp's info dialog ...

BTW, I tried the suggested r.in.gdal program to import a (RGB) TIF
file, which was imported with a strange colour map, while r.in.tiff
preserved the "original" colour map (complaining, however, about
"color level quantization" if "nlev" is not set to something very
high). What does r.in.gdal do with the colour map? And how can I test
quickly, how much information I loose using less colours than
(theoretically) present in the image? "r.mapcalc
x=morecolours-lesscolours" or something like that? 

Regards, Ulf

 > ulf at mail.zmt.uni-bremen.de wrote:
 > 
 > > Trying to import a greyscale TIF file (24 bit colour depth), I get the
 > > following message:
 > > 
 > >  GRASS:~/daten/gis/grass > r.in.tiff input=BANDA1.TIF output=band1
 > >  ERROR: Only handle 1-channel gray scale or 3-channel color. Try -f switch.
 > 
 > That error indicates that the number of samples per pixel (i.e. 
 > channels) was something other than 1, 3 or 4, according to
 > TIFFGetField(TIFFTAG_SAMPLESPERPIXEL).
 > 
 > > Anyway, r.in.tiff does not accept a "-f" switch (does it come from an
 > > internally used r.in.bin?).
 > 
 > No; that's just an error. I will remove the references to "-f".
 > 
 > > What are your recommendations in respect
 > > to this error? 
 > 
 > Convert the data to something which r.in.tiff supports.
 > 
 > > The TIF file originates from a satellit image in a particular format
 > > but was extracted using a utility coming with the image. In theory, I
 > > also could use the original files (1 byte per pixel, 3200 rows, 3520
 > > lines, 512 byte header). Do I have to cut the header of 512 byte with
 > > a self-made program to use r.in.bin,
 > 
 > Yes.
 > 
 > > or is there another import
 > > facility I could use?
 > 
 > I don't think so.
 > 
 > -- 
 > Glynn Clements <glynn.clements at virgin.net>
----------------------------------------------------------------------
 > > 
 > > Trying to import a greyscale TIF file (24 bit colour depth), I get the
 > > following message:
 > 
 > Their isn't any 24bit greyscale format in the base TIFF 6 standard.
 > Only, monochrome, 8 bit greyscale, 8 bit palette color, and 24 bit
 > RGB color.
 > 
 > >  GRASS:~/daten/gis/grass > r.in.tiff input=BANDA1.TIF output=band1
 > >  ERROR: Only handle 1-channel gray scale or 3-channel color. Try -f switch.
 > 
 > r.in.tiff isn't very flexibile about it's TIFF support.  It's also fairly
 > buggy in general.
 > 
 > > Anyway, r.in.tiff does not accept a "-f" switch (does it come from an
 > > internally used r.in.bin?). What are your recommendations in respect
 > > to this error? 
 > 
 > Hmm, shouldn't be an -f switch...
 > 
 > > The TIF file originates from a satellit image in a particular format
 > > but was extracted using a utility coming with the image. In theory, I
 > > also could use the original files (1 byte per pixel, 3200 rows, 3520
 > > lines, 512 byte header). Do I have to cut the header of 512 byte with
 > > a self-made program to use r.in.bin, or is there another import
 > > facility I could use?
 > 
 > Perhaps you could use the original.  r.in.gdal supports a number of
 > formats. Also, it's tiff support is better than r.in.tiff.
 > 
 > Since you say the original is 1 byte per pixel, I wonder why the
 > conversion tool you used would write a tiff with more bytes?
 > Anyway, there may be some options.  If you know the extents, you
 > probably could use r.in.bin, by first chopping off the 512 byte
 > header and specifying coordinate info on the command line.  Or, you 
 > could try writing an ESRI style header file (*.hdr)
 > and renaming the original file to (*.bil).  The header has things
 > like data type, rows, columns, and upper left pixel coordinate.
 > r.in.gdal can handle those pretty easy..
 > 
 > -- 
 > Eric G. Miller <egm2 at jps.net>

-- 
=======================================================================
 Ulf Mehlig    <ulf.mehlig at zmt.uni-bremen.de>
               Center for Tropical Marine Ecology/ZMT, Bremen, Germany
-----------------------------------------------------------------------



More information about the grass-user mailing list