I've been using a color ramp with fixed values (0-255) corresponding to specific rgb color (discrete interpolation) for 8bit tifs in QGIS. I've used matplotlib to apply built in colormaps, but I'm trying to figure out how to create a matplotlib custom colormap to replicate the results I get from QGIS that uses this fixed scale.
Example fixed value color ramp
# QGIS Generated Color Map Export File # val, r, g, b, a, label INTERPOLATION:INTERPOLATED 133,178,178,178,255,1 138,0,120,120,255,2 142,0,190,190,255,3 ... and so on
Any pointers on how to go about this? I was able to get fairly close with gdaldem color-relief but its interpolation is adjusting some of the values where it isn't quite as good as what QGIS is outputting... I'm assuming because its automatically using linear interpolation vs discrete