Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I'd like to include conversion to a 3 band RGB raster in a script to prepare multiple DEMs for image processing. The input files are rasters extracted from a raster mosaic.

The manual option is to use the Export Data option in the TOC, but I have to repeat this for 15-25 different rasters so I'd like to automate it.

Each input raster is a single band that I'd like to force RGB like the image below (maunal method).

enter image description here

share|improve this question
    
maybe this is what your looking for arcpy.RasterToOtherFormat_conversion() –  dango Jun 28 '12 at 19:39
    
Unfortunately I don't think 3-band RGB is an option –  Roy Jun 28 '12 at 20:21
add comment

4 Answers 4

up vote 2 down vote accepted

I got some help from an ESRI employee. Apparently there isn't a Python method available to accomplish this, but you can export a Raster and force RGB through ArcObjects (IRasterLayerExport Interface).

share|improve this answer
add comment

I think you want to use the Copy Raster tool. It is in the Data Management Toolbox under Raster / Raster Dataset or arcpy.CopyRaster_management. Be sure to set the colormap_to_RGB value.

share|improve this answer
    
This certainly looks like the right tool, but I can't seem to get a three band output. I'm getting a 1 band with stretched symbology. –  Roy Jun 29 '12 at 12:10
add comment

I don't have time to test this but it should work :). If you take the total number or pixels in your raster and multiple it three and use this number to create a numpy array. This array can be then reshaped into a 3 dimensional array. Now you have an empty array that represents your RGB raster. So if you now convert your original DEM till a numpy array you could loop over it and add the values to your newly created array and then save that as what every image type you want. Good luck, happy looping!!

share|improve this answer
add comment

Try the Composite Bands (Data Management) tool:

  • This tool can also create a raster dataset containing subset of the original raster dataset bands. This is useful if you need to create a new raster dataset with a specific band combination and order.
  • The order that the bands are listed in the Multi-value Input control box will determine the order of the bands in the output raster dataset.
share|improve this answer
    
Thanks, but the original file is a single band raster, this looks like a tool for combining several single band rasters into a multi band composite rather than forcing a single band into a 3-band RGB. –  Roy Jul 2 '12 at 11:34
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.