I = imread('pout.tif');
J = imadjust(I);% adjust the image gray
subplot(121), imshow(I); subplot(122), imshow(J)
I = imread('cameraman.tif ');
J = imadjust(I,[0,0.2],[0.5 1]);% adjust the image gray to the specified range
subplot(121); imshow(I); subplot(122); imshow(J)
I = imread('rice.png');% read the image
J = imadjust(I,stretchlim(I),[0 1]);% determine the gray scale of the mapping and adjust the gray scale
figure,% display the changed image and Histogram
subplot(221),imshow(I); subplot(222),imshow(J);
subplot(223),imhist(I); subplot(224),imhist(J);
[X,map]=imread('forest.tif');
I=ind2gray(X,map);% indexed image is converted to grayscale image
J=imadjust(I,[0 1],[0 1],0.5) ;%gamma correction
figure,
subplot(121),imshow(I); subplot(122),imshow(J)