I have 1-band GeoTIFF file. The color interpretation for band is gray. I want a color table in order to transform my Col.tiff
to Col.jpeg
or Col.png
.
I tried putting a color table in this tiff via a .vrt:
gdal_translate -of VRT Col.tiff Col.vrt
then adding in the .vrt:
<ColorInterp>Palette</ColorInterp>
<ColorTable>
<Entry c1="0" c2="0" c3="255" c4="240"/>
<Entry c1="0" c2="0" c3="254" c4="240"/>
<Entry c1="0" c2="0" c3="253" c4="240"/>
<Entry c1="0" c2="0" c3="252" c4="240"/>
</ColorTable>
And translate again :
gdal_translate Col.vrt Col.tiff
But it answered:
Warning 1: Unable to export color table to GeoTIFF file. Color tables can only be written to 1 band or 2 bands Byte or UInt16 GeoTIFF files.
How can I do it?
For information, there is gdalinfo for the Band:
Band 1 Block=55x18 Type=Float64, ColorInterp=Gray
Description = Something
Metadata:
GRIB_COMMENT=Something[p]
GRIB_ELEMENT=TMP
GRIB_FORECAST_SECONDS=0 sec
GRIB_REF_TIME=1401926400 sec UTC
GRIB_SHORT_NAME=SMTHG
GRIB_UNIT=[p]
GRIB_VALID_TIME=1401926400 sec UTC
Best Answer
with gdal, you can color an image based on gdal_dem (color_relief)
Rem: in you case, your gdalinfo outputs inform you that your original file is in Float, while the use of color tables requires Byte or UInt16. Therefore you could translate your file using '''gdal_translate input.tif output.tif -ot Byte''' in order to allow for unique values.