I am trying to colour a single band grey raster (NDVI) using gdal to match the same colouring when I bring the raster into QGIS and colour it with a cumulative count cut (2%/98%). When I use the code:
gdaldem color-relief raster_ndvi.tif colour_percent2test.txt -alpha raster_ndvi_colour.tif
with my colour textfile:
98% 26 153 71
74% 161 209 106
50% 255 255 197
26% 254 177 101
2% 255 0 0
nv 0 0 0 0
I get a similar raster as the QGIS version, but I don't see as much red
This is the QGIS output:
And this is what I get from the gdal code:
I have also tried using a colour textfile:
100% 26 153 71
98% 26 153 71
74% 161 209 106
50% 255 255 197
26% 254 177 101
2% 255 0 0
0% 255 0 0
nv 0 0 0 0
and it ends up looking the exact same as the other attempt.
Any suggestions on how I can get my colouring to match QGIS without typing in the actual raster values in the colour ramp?
I want to be able to colour multiple rasters this way without needing to know the raster values to type them into the textfile each time (so 0.37 = red, 0.504 = orange, etc.) as this would take more time and I may as well just use QGIS instead.