There are lots of questions on here regarding raster conversion, but I can't find anything specific to my needs (involving output as RGB and using a Colormap).
I have a folder full of ESRI GRID format files that I need to convert to TIFF. The part that I'm finding difficult is having the output come out as RGB (I hope to eventually convert these to tiles). When I export one of my grid files as in this first image, it works great. If I just try to straight convert the GRID to tif using something like
it creates an image that looks all black to irfanview or any other image viewing program (possibly because the GRID files are binary 1 or 0 ?). It needs to show values of 1 as a color (best if I can make it always the same color of my choosing) and 0 as no color (if possible).
This works great when I do it this way ...
But I want to do this programmatically because there are quite a few of them. Does anyone know of a way to achieve the results I get from Data Export using arcpy and Python (maybe with Environment variables). What am I missing ?
I've noticed that if I have a clr color map file named after the input grid file, and check the "Use Colormap" box, I can get consistent output. This is the color map I was testing with.
0 0 0 0 1 56 168 0
UPDATE: I have tried some of very helpful the suggestions provided in comments below by Michael Miles Stimson and can get the desired result using CopyRaster_management with a colormap file (the input can be 1 or 3 bands, it is the output that needs this file to inform the output). I had some trouble with NoData values (in a separate question) but Chris W helped me with that. I tried using gdal_translate -Expand RGB, but I didn't see any way to specify the exact colors I wanted in the output.