I am reading a 24 bit bitmap:
var P: PByteArray;
...
for y:=0 to Bmp.Height-1 do begin
P := Bmp.ScanLine[y];
for x:=0 to Bmp.Width-1 do begin
R := P[3*x+2];
G := P[3*x+1];
B := P[3*x ];
Now I will change the RGB to BGR:
P[3*x+2] := B;
P[3*x+1] := G;
P[3*x ] := R;
So, if I had something red in my image, now it is blue and blue is red. But the problem is brightness changes, and the new image is darker or brighter than the original image. How can I make my output image bright / dark like an input image?
source
share