[EXTERNAL] [rasterio] Applying Color Ramp to Single-Band Grayscale Images


Hare, Trent M
 

Nathan,
  Not sure about using rasterio, but have you tried gdaldem using "color-relief"?


shows creating a colorized image and adding hillshade (hillshade step not needed here):

-Trent


From: main@rasterio.groups.io <main@rasterio.groups.io> on behalf of nathan.raley via Groups.Io <nathan.raley@...>
Sent: Tuesday, March 24, 2020 3:12 PM
To: main@rasterio.groups.io <main@rasterio.groups.io>
Subject: [EXTERNAL] [rasterio] Applying Color Ramp to Single-Band Grayscale Images
 
Does anyone have any methods of applying a color ramp to a grayscale image? 

I have a NDVI calculated image I am trying to apply color ramp for the decimal based value ranges, but have no idea how to accomplish this.  I was wandering if this was possible via any of the rasterio libraries, and, if so, how would one go about accomplishing this?  I have other band based calculations I'd like to attempt, but until I can figure out how to apply the color ramps, I am at a stand still.

Thanks,


nathan.raley@...
 

Thanks Trent,

I have looked into that, but the part of using the colormap.txt portion still is a bit confusing.  I haven't been able to find sufficient documentation on how to create that file to apply the color, or a ramp between two color ranges, for the values.  I did find a method in the python wrapper library for gdal that supported creating a color ramp for ranges using a specified color; however, that only supported whole number values and not the float based values you get from the NDVI image.


nathan.raley@...
 

Actually, that second link looked like he had the format where it was using decimal based values, that might work.  I'll give it a try.  Thanks!