[GRASSLIST:1451] Re: r.patch geotiff-mosaic wrong color problem

Markus Neteler neteler at itc.it
Thu Oct 9 04:09:46 EDT 2003


On Wed, Oct 08, 2003 at 09:34:39PM +1300, Hamish wrote:
> > > An 8bit tiff uses a color palette. The value of any given pixel is
> > > used to lookup the red,green,blue value in a table. The table is the
> > > palette, and is a part of the tif file. It is likely that each of
> > > tiff's has a different palette. The color table for each image is in
> > > the colr directory of your location. They are just ASCII files.
> > >
> > > You can preprocess each image with Gimp or Photoshop so that they
> > > all have the same color palette before you import them into GRASS,
> > > or you can convert them to 24bit tiffs before importing. In a 24bit
> > > tiff each pixel has 3 bytes, one each for red, green, and blue, so
> > > no color palette is used.
> ...
> >
> > We had the same problem, but we solved it within GRASS:
> > 1.step: Import the 24-bit image with r.in.gdal (produces three GRASS
> > raster maps: red, green, blue)
> > 2.step: change the colormap of the channels (red, green, blue) with
> > r.colors  map=... color=grey
> 
> Beware if the maps do not cover the full range of color data, i.e.
> 0-255. Use r.info to check.
> 
> Better:
> 
> r.colors INPUT_MAP color=rules << EOF
>   0 black
>   255 white
> EOF

BTW: The CVS version of r.in.gdal was updated to apply this color table
(0 black, 255 white) automatically.
 
Markus




More information about the grass-user mailing list