%% Randomly Reorder Colormap and Display Image
% Read the first image, X, and its associated colormap, map, from the sample indexed image file, corn.tif. Display the image.

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

%
% Randomly reorder the colormap to get a new colormap, newmap. Display image X with the new colormap.

[Y,newmap] = cmpermute(X,map);
colormap(newmap)

% Copyright 2015 The MathWorks, Inc.