[GRASS-user] Re: Quantization of a true color GeoTIFF

Hamish hamish_b at yahoo.com
Mon Feb 11 22:46:08 EST 2008


> > Hamish schrieb:
> >> I have a 16244x12706 GeoTIFF file (600dpi scan) which is made up
> >> of 7 colors but came as a 3-band 24bit True Color image.
...
> >> I want a CELL map with cat=[1,2,3,4,5,6,7] values with RGB set for
> >> each category by r.colors.

WolfgangZ wrote:
> > you could try the script rgb2pct which is included in the gdal 
> > utilities. with "-n number" you can set the number of colors.

Thanks. I had a look at that but it dithers, which I wish to avoid.


Adam Dershowitz provided a tip which solved this for me.
Gimp was thresholding it against some standard palette spread causing
bad results. I could deal with modifying the palette, but two of the 7
colors were shades of blue, they were always lumped together. From the
description of rgb2pct that may be a bit smarter in that regard.

The trick was to create a custom palette in the Gimp using the
eye-dropper tool on the original image to grab the colors. Then run the
Gimp's indexing tool with that palette as the guide, and it gave me the
desired 7 color map to pass to GRASS. From there it all worked nicely.


cheers,
Hamish



      ____________________________________________________________________________________
Be a better friend, newshound, and 
know-it-all with Yahoo! Mobile.  Try it now.  http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ 




More information about the grass-user mailing list