Showing results for 
Search instead for 
Do you mean 

Gray scale images: how to change pixel colors and recode.

by Technical Evangelist on ‎02-12-2016 12:40 PM - edited on ‎03-21-2016 06:56 PM by Anonymous (5,803 Views)


How to change the color of the pixels in a gray scale image to see which grouping represents the best two classes of objects. For example, how to apply the color yellow to pixels with values greater than 240 and apply the color black to pixels with values less than 239? After changing the colors, how to recode the data to produce a new image with these two classes?


In order to change the colors of a gray scale image you should display it in a 2D View as Pseudo Color. This is done in the Select Layer To Add dialog under the Raster Options tab when selecting the image to display in the 2D View (Display as: Pseudo Color).


With the image displayed in a 2D View, open the attribute table (Table tab > View group > Show Attributes) and look for the Color column displaying the color (gray scale level) for each pixel value. Click on a cell in the Color column to change the color. You can select multiple rows and change the color for all of them at the same time. This is be done by holding down the Shift key and clicking in the Row column or by clicking in the Row column and holding down the left mouse button and moving your cursor up or down. You can also use the Selection Criteria dialog (Table tab > Query > Criteria) to select a group of pixels that match your desired criteria. For example, entering the criteria “row >= 240” would select all of the pixels that have a value greater than or equal to 240. After they are selected in the attribute table you can change the color.


Use the Recode tool to create a new image with two classes. Open the Recode tool (Raster tab > Raster GIS group > Thematic menu > Recode) and click the Setup Recode button to display the Thematic Recode dialog. In the Thematic Recode dialog, right-click in the Value column and select Criteria from the pop-up menu to display the Selection Criteria dialog.  Enter your desired selection criteria (example: row >= 240) and click Select, and then click Close to return to the Thematic Recode dialog. Enter the new value that you want to change all of the selected values to and click the Change Selected Rows button. Now right-click in the Value column and choose Select None. Repeat this procedure for the other values that you want to change (example: row <= 239) and then click OK to return to the Recode dialog. Enter a name for your output file and click OK.