Check out example codes for "matlab invert image". It will help you in understanding the concepts better.
Code Example 1
% Reads image im = imread('image.jpg'); % Inverts image invert = 255 - im; % Displays image image(invert)
Learn ReactJs, React Native from akashmittal.com