| 145 | | . |
| | 145 | |
| | 146 | == Create or Edit Color Palette == |
| | 147 | |
| | 148 | ''What is the easiest way to create or edit a color table in an image?'' |
| | 149 | |
| | 150 | 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. |
| | 151 | {{{ |
| | 152 | gdal_translate -of VRT your.tif your.vrt |
| | 153 | }}} |
| | 154 | edit `your.vrt` and modify the color table, see [http://www.gdal.org/gdal_vrttut.html Virtual Format Tutorial] for detailed syntax options. Then |
| | 155 | {{{ |
| | 156 | gdal_translate your.vrt your_fixedup.tif |
| | 157 | }}} |
| | 158 | Note that the .vrt file doesn't actually include the image data, it just references back to your.tif (or other supported format). |
| | 159 | |
| | 160 | 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. |
| | 161 | |