Tip by kenz0
The ColorMatrix option represents a 5x5 matrix used to manipulate the color values of an image in an Image meter. It is divided into five separate parameters, one for each row, each numbered. The default matrix is as follows:
ColorMatrix1=1; 0; 0; 0; 0
The values on the main diagonal are, from top-left to bottom-right: Red, Green, Blue, Alpha and a placeholder. The values represent the percentage of of the particular value present in the image, where 0.0 is none and 1.0 is normal. The remaining entries in the matrix allow a color to have its value modified in terms of another color (ex: the value of Red might have half of the Blue value added), with the entries in the final row (ColorMatrix5) determining offset values that are added directly to the color. (ex: ColorMatrix5=0.5; 0; 0; 0; 1 will add 50% to the red value)
The following shows the actual matrix values of the brightness, contrast, and saturation.
Brightness Matrix Contrast Matrix Saturation Matrix
- The brightness matrix is a simple translation matrix on the RGB elements.
- The contrast matrix is a scaling matrix on the RGB elements. The extra translation parameters in the contrast matrix is used for shifting the base color (when c = 0)from black to gray.
- The saturation matrix re-adjust the RGB color distribution so that at s = 0, R = G = B = luminance brightness in grayscale).
From the above information, we can calculate the proper color matrix to transform a given image. To use all three matrices, we need to multiply them together into one single transformation matrix (using matrix multiplication). The result of multiplication is as follows:
R G B A W R G B A W R G B A W
Apply the above method to an actual Rainmeter config
You can set the value in [Variables] arbitrarily.
- Brightness = 0
- Contrast = 1
- Saturation = 1
Some examples of matrix values as a color filter
[Swap RGB to BGR]
;Swap RGB to BGR
[Black & White]
;Black & White
[White to Alpha]
;White to Alpha
Create a realistic old photo using ColorMatrix.
First, adjust each RGB matrix values and increase contrast slightly like this.
Next, find an image of some old paper and overlay it on the original image.
Then, increase the contrast of the old paper, and set the alpha value of the whole image to 50%.
Full code for this effect: