使用imwrite()函数
A=imread('IM.jpg');
>> A=rgb2gray(A);
>> A=im2double(A);
>> subplot(1,2,1);
>> imshow(A);
>> title('yuantu');
>> B=zeros(256,256);
>> B(40:200,40:200)=1;
>> K=A.*B;
>> subplot(1,2,2);
>> imshow(K);
>> title('jubutu');
imwrite(yc,'cameraman.png')