I have a three-band raster:
I would like to convert this to a single-band raster using QGIS, but retain the colours from the three-band version. I can use the Raster Calculator to create a single-band raster with ("File@1" + "File@2" + "File@3") / 3
, but this gives a greyscale version:
How can I transfer the original colours from the three-band raster? I'm sure there should be a way to do this, but I don't know what I should be searching for. Perhaps this is similar to this question using R, about extracting the colour table from a raster? I thought it might be something like Toolbox > GRASS > Raster > r.colors
but the output of that tool doesn't seem relevant?
Edit
In response to a comment below, here is the sort of output I hope for. A single band raster, with unique colours for each of the 256 colours:
GDAL translate
to make a jpeg, but the output file still has three bands? Also I prefer to keep it as a raster because I have to do more analysis on it afterwards.Paletted/Unique values
option in the layer symbology. The key is using colour values that "make sense", i.e not just random colours. The difficulty is finding out what those colour values should be. I've added an example where this is used to my question, but I can't just copy the layer style as the raster values are not the same.