function [img, size1] = cut_image_center(fname,N,fname1)
% [img, size]: image matrix and size vector(width,height, max_gray)
img = readp5(fname);

sr = floor((size(img,1)-N)/2)+1;
sc = floor((size(img,2)-N)/2)+1;
img=img(sr:(sr+N-1), sc:(sc+N-1));

writep5(img,fname1);
%for i=1:width
%for j=1:height
%      img(i,j) = img1(j,i);
%   end
%end
return
