I am trying to accomplish quite simple operation, but it proved to be impossible using arcpy.
I have an orthophoto where I want to set areas on the edges to NoData value. The final raster is supposed to be 8bit unsigned TIFF file, with JPG compression and RGB value 0,0,0 will be used to as NoData value.
1. Reclassify the whole image - set all 0 values in all RGB bands to 1
2. Clip the image, and the area outside of the clip will be set to RGB 0,0,0
I tried many different ways to do this to no avail. I found out that I could just use arcpy.CopyRaster_management and set arcpy.env.nodata = "MAP_UP", which should set all 0 to 1, so there should be no 0 value in the resulting raster, but it is not working as described. The 0 values are set to noData and not changed to 1.
I have also try to reclassify and the image, which works on the each band, but this creates a 16BIT TIFFs with range of 1 to 255, just as I wanted, but then when I use arcpy.CompositeBands_management to join the different bands back to RGB image, the file will contain 0 values and also values which are higher than 255, which I do not understand why. Could be the compression algorithm, but I doubt it. Whatever I try, I cannot get it done.
I appreciate any suggestions. This shouldn't be so difficult to do. And why doesn't "map_up" setting doesn't work? Did I misunderstood it?
From the documentation:
NoData (Environment setting)—Help | ArcGIS for Desktop
Thank you
Martin.