function gray2 = image_double_gray ( gray )

%*****************************************************************************80
%
%% image_double_gray() fattens a gray scale image by doubling in both dimensions.
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    02 May 2016
%
%  Author:
%
%    John Burkardt
%
%  Input:
%
%    uint8 GRAY(:,:), the original MxN grayscale image.
%
%  Output:
%
%    uint8 GRAY_2(:,:), the 2*Mx2*N doubled image.
%
  [ m, n ] = size ( gray );
  gray2 = zeros ( 2 * m, 2 * n, 'uint8' );
  for i = 1 : m
    for j = 1 : n
      gray2(2*i-1:2*i,2*j-1:2*j) = gray(i,j);
    end
  end
% gray2(1:2:2*m-1,1:2:2*n-1) = gray(1:m,1:n);
% gray2(2:2:2*m,2:2:2*n) = gray(1:m,1:n);

  return
end
