Replace values in RGB rasters

Discussion created by bogdanpalade on Jul 1, 2013
Latest reply on Jul 1, 2013 by bogdanpalade

My goal is to replace the values of one raster (of all the 3 RGB bands) with the values of another raster (also 3 bands) where the values of the initial raster meet some requirements, for example only where Band_1 (Red) = 205, Band_2 (Green) = 255 and Band_3 (Blue) = 194. The code bellow does not work saying something like the raster 205 is not supported...I also dont know how to loop through the RGB arrays...

Initially I tried to do this in raster calculator but did not figure it out how to do it...
Here I put the code where I want to replace the values of the Image17 with the values of Image16:

import arcpy, os

arcpy.env.workspace = r"Z:\BP\TST"
Image16 = r"Z:\BP\TST\16.tif"
Image17 = r"Z:\BP\TST\17.tif"

Image16_red ="\\Band_1")
Image16_green ="\\Band_2")
Image16_blue ="\\Band_3")

Image17_red ="\\Band_1")
Image17_green ="\\Band_2")
Image17_blue ="\\Band_3")

if Image17_red == "205":
    if Image17_green == "255":
        if Image17_blue == "194":
            output_obj = (Image17_red = Image16_red) & (Image17_green = Image16_green) & (Image17_blue = Image16_blue)

Could you please give me a hint on how to solve this?

Thank you very much