%% Convert RGB Colormap to Grayscale Colormap
% Read an indexed image with an RGB colormap. Then, convert the colormap to grayscale.
% Read the sample file, corn.tif, which is an indexed image with an RGB colormap.

[X,map] = imread('corn.tif');

%
% Display the image.

imshow(X,map)

%
% Convert the RGB colormap to a grayscale colormap and redisplay the image.

newmap = rgb2gray(map);
imshow(X,newmap)

% Copyright 2015 The MathWorks, Inc.