How To: Set the null values of an image to transparent using Avenue
The script in this article changes the no-data cells of a single-band image to transparent. If your image is multiband, double-click the image in the table of contents and select the single-band radio button.
- Open a new script window. A. Activate the Project window.
B. Click the Scripts icon.
C. Click New.
- Copy the following code into the new window.
'-- This script expects the view as the active doc and
'-- your image theme as the first theme in the TOC
theView = av.getactivedoc
'-- Get the image theme from the View
theItheme = theView.Getthemes.get(0)
'-- Get the colormap for that image's legend
thelegend = theItheme.getlegend
theColormap = theLegend.Getcolormap
'-- Make the color for the no data value transparent
thenewColor = Color.Make
'-- Reflect the changes in the Legend
- Click the Compile button.
- Tile the windows so that you can see both the view and the script.
- Click the view, then click the script.
- Click the Run button.
To reverse the effects of this script, double-click the image and click default in the legend window.