Tuesday, 16 August 2016

gdal - Applying specific Rendering to Raster and export to JPEG?


We have a specific process which generate an interpolated single band 32-bit Float Raster in Erdas Imagine (.IMG) format. This process generates an image every hour.


We wish to apply a specific stretched renderer, which stretches from Green to Red, to the single band raster and then save it as a JPEG file.



I have found that it can be done through the UI in ArcMap by applying the .lyr file, and then exporting to JPEG 2000. The Jpeg 2000 is converted to the regular JPEG image by python.


We now want to automate this process and run it using some open source or free tool.


Is it possible to do something like this in GDAL or some other command line tool?



Answer



Evil Genius seems to have a good idea, but actually the color-relief file can be set using percentages as well as min and max. So you could write the file using something like:


0%    green
100% red

So the command would be something like:


gdaldem color-relief inputfile.img colorfile.txt output.jpg -of "JPEG2000"

No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...