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

Richard Greenwood Rich at GreenwoodMap.com
Tue Oct 7 09:02:05 EDT 2003


At 06:29 PM 10/6/2003 +0200, you wrote:
>Thanks for replying, Mr.Greenwood, Mr.Warmerdam,
>
>Mr. Greenwood, could you explain which steps are necessary to preprocess the
>8bit-tiff images with Gimp, so that all use the same color palette?
>If possible I want to avoid using 24bit geotiff, I think gdal can't even
>import 24bit geotiff, only 8bit. So I need r.in.tiff to import and
>georeference it afterward which I want to avoid, too.
>
> > 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.

It has been a year or so since I last used The Gimp, so I can not give you 
exact steps. But there is a good book on The Gimp that you can read online 
at:  http://gimp-savvy.com/BOOK/

The basic idea is to use The Gimp to create a good color palette for your 
images and then apply that palette to all the images before importing them 
into GRASS. Open one representative image and use The Gimp to create a 
palette optimized for that image, and save the palette. Then open each of 
the other images and apply the saved palette to each image.

Gdal can import 24 bit images into GRASS. They will be imported as three 
layers (or "maps") in GRASS e.g. if you were to import "image_a.tif" you 
would have image_a.1, image_a.2, image_a.3 for red, green, and blue 
channels. And then you could use r.patch to patch the red, green, and blue 
channels from your various images together.

Converting your images to a single 8bit palette prior to importing makes 
them smaller and easier to work with in GRASS, but you have the added 
effort of converting the images beforehand.

Good luck,
Rich


Richard W. Greenwood, PLS
Greenwood Mapping, Inc.
Rich <at> GreenwoodMap <dot> com
(307) 733-0203
http://www.GreenwoodMap.com  




More information about the grass-user mailing list