[GRASS-user] standardizing raster color tables
Glynn Clements
glynn at gclements.plus.com
Thu Jul 6 18:27:34 EDT 2006
Jed O. Kaplan wrote:
> I have a series of geotiff files that are 8-bit paletted pseudocolor
> images. I imported these into GRASS rasters with r.in.gdal.
> Unfortunately each separate image file has a different color table,
> though they are a sort of DRGs so the original scans had
> approximately all the same colors.
>
> I would like to convert all the rasters to have a standard color
> table, so that, e.g., I can merge the files into a single image,
> perform other GIS operations, etc.
>
> Is there any way using GRASS tools that I can give all of my
> individual images the same color table? The image files are large
> (ca. 2000x3000 pixels), but I could convert them temporarily to rgb
> images and then reduce the colors. I have a standard color table in
> another geotiff file.
>
> I have tried to do this using the imagemagick tool: convert -map
> <file> <infile> <outfile> but this process is impossibly slow.
Is pnmremap (from NetPBM) any quicker?
> Any suggestions for (standardized, semi-automated) color reduction
> for DRG's would be much appreciated.
r.composite and r.reclass would work, but I don't know if it would be
any quicker than ImageMagick option. Can you not just leave it running
overnight? Or are you expecting it to take days?
I can provide source code for a tool to generate mapping tables for a
set of palettes; the main issue is figuring out how to get the
palettes out of the TIFF files in a usable format (reading and writing
TIFF files is a lot more work than remapping palettes).
Have you already imported the (un-remapped) images into GRASS? If so,
do the colour tables (in the "colr" subdirectory) consist of discrete
entries (one line for each colour index)? Those would be easy enough
to read (rules using colour ramps are more work).
--
Glynn Clements <glynn at gclements.plus.com>
More information about the grass-user
mailing list