This repo focuses on editing BMP images at pixel level using C. For ease of use I used QDBMP library. And for Grayscale techniques I followed Tanner Helland's article.
Original Image
To get negative of an image, we just invert each color in each pixel of the image.
While converting a colored image to greyscale, a grey value is calculated from RGB values of the pixel and all the 3 RGB values are updated to the same grey value. This grey value depends upon the algorithm used. In this method grey value is simply the average of all 3 RGB values of a pixel. This method uses an algorithm specified by the original ITU-R recommendation (BT.709, specifically) to calculate the grey value. This method takes the average of the max and min values of a pixel and assigns it as the grey value. There are two ways to decompose an image. This uses the max value of all the 3 channels for the grey value. This uses the min value of all the 3 channels for the grey value. This method uses data from a single color channel. This uses the red channel directly as gray. This uses the green channel directly as gray. This uses the blue channel directly as gray.
For better understanding of the SCC method, I am including another example here.
Original Image
SCC Red
SCC Green
SCC Blue
In this method, the greyscale image is generated based on the number of shades of grey we define. As the number of shades of grey increases the image gets better and better.
2 shades of grey 3 shades of grey 4 shades of grey 8 shades of grey 16 shades of grey 32 shades of grey 64 shades of grey 128 shades of grey 256 shades of grey