function newIm = toNegative(im)
% newIm is the negative of image im

[nr,nc,np]= size(im);    % dimensions of im
newIm= zeros(nr,nc,np);  % initialize newIm with zeros
newIm= uint8(newIm);     % Matlab uses unsigned 8-bit int for color values

for r= 1:nr
    for c= 1:nc
        for p= 1:np
            newIm(r,c,p)= 255 - im(r,c,p);
        end
    end
end

