tic;
A=imread('001.jpg');
k=2;%设置k*l个分块
l=4;
z=1;%输出图片的编号
[m,n,p]=size(A);
for x=1:k;
for y=1:l;
for t=1

;
for i=1:m/k;
for j=1:n/l;
B(i,j,t)=A(uint16((x-1)*m/k+i),uint16((y-1)*n/l+j),t);
end
end
end
imwrite(B, ['s', num2str(z), '.jpg'], 'jpg');
z=z+1;
end
end
toc;