Changes between Version 22 and Version 23 of FAQRaster
- Timestamp:
- Jan 12, 2010, 3:19:43 PM (14 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
FAQRaster
v22 v23 144 144 145 145 146 == Create or Edit Color Palette==146 == How to create or modify an image color table ? == 147 147 148 ''What is the easiest way to create or edit a color table in an image?'' 148 The easiest non-scripting way to create or modify a color palette is to translate your file to VRT (XML) format, and edit the color table in the XML file. 149 {{{ 150 # create the vrt 151 gdal_translate -of VRT your.tif your.vrt 149 152 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 {{{ 153 ## --- edit colour table here --- 154 155 # create final fixed image 156 156 gdal_translate your.vrt your_fixedup.tif 157 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 158 160 Th is 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.159 The .vrt file doesn't actually include the image data, it just references back to your.tif (or other supported format). 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 160 161 Here is an example for [http://topomaps.usgs.gov/drg/ USGS DRGs], see [http://www.gdal.org/gdal_vrttut.html Virtual Format Tutorial] for detailed syntax options. The entries are in palette order and correspond to red, green, blue & alpha channels. 162 {{{ 163 <ColorInterp>Palette</ColorInterp> 164 <ColorTable> 165 <Entry c1="0" c2="0" c3="0" c4="255"/> 166 <Entry c1="255" c2="255" c3="255" c4="255"/> 167 <Entry c1="0" c2="151" c3="164" c4="255"/> 168 <Entry c1="203" c2="0" c3="23" c4="255"/> 169 <Entry c1="131" c2="66" c3="37" c4="255"/> 170 <Entry c1="201" c2="234" c3="157" c4="255"/> 171 <Entry c1="137" c2="51" c3="128" c4="255"/> 172 <Entry c1="255" c2="234" c3="0" c4="255"/> 173 <Entry c1="167" c2="226" c3="226" c4="255"/> 174 <Entry c1="255" c2="184" c3="184" c4="255"/> 175 <Entry c1="218" c2="179" c3="214" c4="255"/> 176 <Entry c1="209" c2="209" c3="209" c4="255"/> 177 <Entry c1="207" c2="164" c3="142" c4="255"/> 178 </ColorTable> 179 }}} 180 181 ^Source: http://n2.nabble.com/simplest-method-for-creating-editing-a-GTiff-color-table-td2030656.html#a2030656 .^