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 ... enter image description here

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.

  • Can you check your Geopocessing results window and see if this conversion using the UI shows up in there? If it does drag the symbol of the tool into the Arc Python window and you should have the appropriate syntax to perform the task within a Python script that could iterate over numerous files. – F_Kellner Apr 13 '15 at 20:28
  • 1
    The input raster dataset needs to be single band and have integer values to have a color map. It looks like you are using 3-band images. Have you tried Copy Raster (Data Management)? – Aaron Apr 13 '15 at 20:30
  • Have your tried iterate rasters with the same conversion and defintions you used, using model builder? – dof1985 Apr 13 '15 at 20:33
  • 1
    I use GDAL_Translate -Expand RGB for converting pseudocolour to RGB retaining the georeference. If you really want to do this in arcpy use Copy Raster resources.arcgis.com/en/help/main/10.1/index.html#//… with colormap_to_RGB = "ColormapToRGB" – Michael Stimson Apr 13 '15 at 22:01
  • The color map is a symbology, so I would expect that if you're trying to do this in a script you would first need to apply that symbology prior to exporting. The grid itself contains no color information; unless an associated color map is present the default renderer takes over on load and it's random. If the color map name shares the same name as the input, I believe it's read by default. However if you have a single color map you want to apply to all grids... well you'd have to apply it. – Chris W Apr 13 '15 at 22:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.