![]() |
VOOZH | about |
Prerequisites:
In this set, we will be converting a colored image to a negative image.
Colored Image (RGB Color Model) - The RGB color model is an additive mixing model in which red, green, and blue light are added together in various ways to reproduce a broad array of colors.
Negative Image - A negative image is a total inversion, in which light areas appear dark and vice versa. A negative color image is additionally color-reversed, with red areas appearing cyan, greens appearing magenta, and blues appearing yellow, and vice versa.
Image negative is produced by subtracting each pixel from the maximum intensity value. For example in an 8-bit grayscale image, the max intensity value is 255, thus each pixel is subtracted from 255 to produce the output image.
Note: In a negative image the Alpha component of the image will be the same as the original image, but the RGB will be changed i.e, all three RGB components will be having a value of 255-original component value.
Note: This code will not run on online IDE as it needs an image on disk.