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

WolfgangZ wollez at gmx.net
Mon Feb 11 03:39:28 EST 2008


Hamish schrieb:
> Hi,
> 
> 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 can import with r.in.gdal as red,green,blue bands, but it's huge and
> slow.
> 
> I can't use pnmquant as it overflows the RAM. (I have 2GB physical + 2GB
> swap)
> 
> I tried Indexing it to a small number of colors with the Gimp, but after
> the process the colors were all changed. I can index as 256 colors with
> little color change in the Gimp, but that is still 249 more than I need.
> 
> I want a CELL map with cat=[1,2,3,4,5,6,7] values with RGB set for each
> category by r.colors.
> 
> I guess I can use the Gimp to index to 7 (wrong) colors, import that into
> GRASS, then use r.colors + the Gimp's eye-dropper tool on the original to
> fix them.
> 
> Staying with the original 3-band import, how to find the 7 peaks in the
> r.composite histogram, filter out anything that isn't a peak by changing
> its value to be that of the nearest peak, and reclass to 1-7? As
> r.reclass can take ranges for input, I guess I can be a bit sloppy in
> finding the peaks and use the result of r.stats as input to r.reclass,
> then extract a "hardcopy" from the reclass map with r.mapcalc a=b.
> 
> 
> ?
> any one have a bright idea how to do this with minimal data loss
> ?
> 
> 
> thanks,
> Hamish
> _______________________________________________
> grass-user mailing list
> grass-user at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/grass-user
> 


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

regards
wolfgang



More information about the grass-user mailing list