[Gdal-dev] simplest method for creating/editing a GTiff color
table
Frank Warmerdam
warmerdam at pobox.com
Thu Jul 5 14:43:17 EDT 2007
Gregory, Matthew wrote:
> Sorry for a what is likely a very simple question, but a day of web
> searches has left me frustrated ...
>
> I have a simple GeoTiff that has an embedded Color Table with this
> gdalinfo:
>
> Driver: GTiff/GeoTIFF
> Size is 13354, 7330
> ....
> Band 1 Block=13354x1 Type=Byte, ColorInterp=Palette
> Color Table (RGB with 256 entries)
> 0: 0,0,0,255
> 1: 254,254,254,255
> ...
>
> What is the easiest way (GDAL or not) to edit this color table? Or
> alternatively, what is the easiest way to create and associate a color
> table with a GeoTiff? Sorry if this has been addressed already.
Matt,
The easiest non-scripting way to do this is to translate your file to
VRT (XML) format, and edit the color table in the XML file.
eg.
gdal_translate -of VRT your.tif your.vrt
edit your.vrt and modify the color table.
gdal_translate your.vrt your_fixedup.tif
Note that the .vrt file doesn't actually include the image data, it
just references back to your.tif.
This general approach can be used to modify metadata, color tables,
gcps and other things for which there is no easy to do set them with
gdal_translate.
There are other mechanisms to do this via scripting or c/c++ programming.
Best regards,
--
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush | President OSGeo, http://osgeo.org
More information about the Gdal-dev
mailing list