[gdal-dev] Change color to TIF file with GDAL

AlonMF mirror.zbeng at gmail.com
Fri Mar 8 03:30:33 PST 2019


Hello everyone
I have a tif file named ndvi.tif that contains values between 1 and 1. The
file is with one band.
In addition, I have a ndvi.vrt file which I am trying to edit.
My goal is to change the color of the image according to green-orange color
values. Currently the picture is black and white

I run the command:
gdal_translate -of GTiff -ot Float32 C:\Users\oze\test.vrt
C:\Users\oze\modified_palette.tif -scale -1 1

The resulting output is between 69 and 241 and the colors are still in black
and white rather than green-orange as I requested.

This is test.vrt file:

<VRTDataset rasterXSize="1271" rasterYSize="3179">
  <SRS>PROJCS["WGS 84 / UTM zone 36N",GEOGCS["WGS
84",DATUM["WGS_1984",SPHEROID["WGS
84",6378137,298.257223563,AUTHORITY["EPSG","7030"]],AUTHORITY["EPSG","6326"]],PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],UNIT["degree",0.0174532925199433,AUTHORITY["EPSG","9122"]],AUTHORITY["EPSG","4326"]],PROJECTION["Transverse_Mercator"],PARAMETER["latitude_of_origin",0],PARAMETER["central_meridian",33],PARAMETER["scale_factor",0.9996],PARAMETER["false_easting",500000],PARAMETER["false_northing",0],UNIT["metre",1,AUTHORITY["EPSG","9001"]],AXIS["Easting",EAST],AXIS["Northing",NORTH],AUTHORITY["EPSG","32636"]]</SRS>
  <GeoTransform>  7.3790000000000000e+05,  1.0000000000000000e+01, 
0.0000000000000000e+00,  3.6828200000000000e+06,  0.0000000000000000e+00,
-1.0000000000000000e+01</GeoTransform>
  <Metadata>
    <MDI key="AREA_OR_POINT">Area</MDI>
  </Metadata>
  <VRTRasterBand dataType="Float32" band="1">
<ColorInterp>Green</ColorInterp>

    <SimpleSource>
      <SourceFilename
relativeToVRT="0">C:\Users\oze\test.tif</SourceFilename>
      <SourceBand>1</SourceBand>
      <SourceProperties RasterXSize="1271" RasterYSize="3179"
DataType="Float32" BlockXSize="1271" BlockYSize="1" />
      <SrcRect xOff="0" yOff="0" xSize="1271" ySize="3179" />
      <DstRect xOff="0" yOff="0" xSize="1271" ySize="3179" />
    </SimpleSource>
  </VRTRasterBand>
</VRTDataset>


That's how it looks before everything:
<http://osgeo-org.1560.x6.nabble.com/file/t384615/aaaa.jpg> 


This is how it looks after the command is run:
<http://osgeo-org.1560.x6.nabble.com/file/t384615/bbbbbbbbb.jpg> 

It's important to me that the colors look like this:
<http://osgeo-org.1560.x6.nabble.com/file/t384615/ccccccccc.jpg> 


These are the values before:
<http://osgeo-org.1560.x6.nabble.com/file/t384615/ddddddddd.jpg> 


These are the values after:
<http://osgeo-org.1560.x6.nabble.com/file/t384615/zzzzzzzzzzz.jpg> 


That's what it's important for me to see:
<http://osgeo-org.1560.x6.nabble.com/file/t384615/asasasasa.jpg> 

Thanks to everyone who has read and wants to help



--
Sent from: http://osgeo-org.1560.x6.nabble.com/GDAL-Dev-f3742093.html


More information about the gdal-dev mailing list