%
%  >> B = verkleinern( 'Katze.bmp' );
%  >> image( B ); axis image
%
function B = verkleinern( file )                         
   A = imread( file );                                   
   sz = size( A );                                       
   
   D = double(A);
   
   for( z = 1: sz(1)/2 )                                                        
     for( s = 1: sz(2)/2 )                                                     
       B(z,s,:) = uint8( ( D(2*z,2*s,:)   + D(2*z-1,2*s,:) + ...              
                           D(2*z,2*s-1,:) + D(2*z-1,2*s-1,:) ) / 4.0 );       
     end
   end
end