function i = imgread(name)
% usage:
% i = imgread('test'); image(i); set(gca,'ydir','normal');
% imwrite(i(:,end:-1:1,:),'pool.jpg','jpg');     % note the y flip
%
% barnett 6/9/08

f = fopen(name);
nx = fread(f,1,'int');
ny = fread(f,1,'int');
[i n] = fread(f,'single');
i = reshape(double(min(i,1)), [nx ny 3]);   % clip to max values of 1
