%How to read, display, and write an image A = imread('SITE.tif'); %reads the image into a byte array (uint8) the size of the image % with values between 0 and 255 B = im2double(A); % converts to a real array (double) with values between 0 and 1 % this is the preferred format to do calculations C = im2double(imread('SITE.tif')); % in one step figure, imshow(A) % display A in a figure window figure, imshow(B) % display B in a new figure window. imshow works for both uint8 and double figure, imshow(C) % should be the same as B D = 1 - C; %compute negative image figure, imshow(D) imwrite(D, 'SITE_negative.tif') % write a matrix representing a valid image to a TIFF image file