function maketiff(a,fname) % MAKETIFF write a TIFF file % MAKETIFF(A,FILENAME) will autoscale the the matrix A to a 256 level % grey colormap and write it to the file FILENAME in Tagged Image File % Format (TIFF). % % Example: maketiff(pic,'mypic.tif') % Leif.Harcke@stanford.edu % 2001 January 19 a = double(a); % convert to double precision a = a - min(min(a)); % normalize to values between 0 and 255 a = a/max(max(a))*255; a = uint8(a); % convert to bytes % define a greyscale colormap with 256 values tmp1 = linspace(0,1,256)'; cmap = [tmp1 tmp1 tmp1]; imwrite(a,cmap,fname,'tiff');