function Ic=compress2(I,k);
%part d (compress working for any size)
siz=floor(size(I)/2);
width=siz(1); height=siz(2);
if k>min(size(I)/2),k=min(size(I)/2); end;
if k<1, k=1; end;
Ifourier=fftshift(fft2(I));
Ifouriercompressed=zeros(size(I));
Ifouriercompressed(width-k+2:width+k,height-k+2:height+k)= ...
    Ifourier(width-k+2:width+k,height-k+2:height+k);
Ic=real(ifft2(ifftshift(Ifouriercompressed)));
