# MATLAB: How can I reduce the padding

Hi! Can anybody show me what can I do to reduce the padding? I mean, the final result must contain the image matrix in the center and zeros around it. Something like:
0 0 0 0 0 0 0
0 0 0 0 0 0 0
0 0 2 6 7 0 0
0 0 6 8 8 0 0
0 0 1 3 5 0 0
0 0 0 0 0 0 0
0 0 0 0 0 0 0
image_zg=imnoise(image,'gaussian',0,0.005);
image_out=filtrare_liniara(image_zg,e);
figure;
subplot(1,3,1);imshow(image);
subplot(1,3,2);imshow(image_zg);
subplot(1,3,3);imshow(image_out);
and the linear function:
function im_out = filtrare_liniara(im_in,se)
[m,n]=size(im_in);
im_out=zeros(m,n);
im_in=double(im_in);
for i=2:m-1
for j=2:n-1
vecinatate = im_in(i-1:i+1,j-1:j+1);
temp=se.*vecinatate;
temp=sum(sum(temp));
im_out(i,j)=temp;
end
end
im_out=uint8(im_out);
end

``A = [ ...0 0 0 0 0 0 0 0 0 0 0 0 0 00 0 2 6 7 0 00 0 6 8 8 0 00 0 1 3 5 0 00 0 0 0 0 0 0 0 0 0 0 0 0 0];[r,c] = find(A);rs = min(r):max(r);cs = min(c):max(c);A_compact = A(rs,cs);``
``>> A_compactA_compact =     2     6     7     6     8     8     1     3     5``