I have a BMP (or JPG) image in a TImage component. Im calculating the average colour of the bitmap using the next code fragment:
Count := 0;
for y := 0 to Image1.Picture.Height-1 do
for x := 0 to Image1.Picture.Width -1 do
L := Form1.Image1.Picture.Bitmap.Canvas.Pixels[x,y];
R := R + ((L shr 16) and $FF);
G := G + ((L shr 8) and $FF);
B := B + (L and $FF);
R1 := R div Count;
G1 := G div Count;
B1 := B div Count;
This code fragment does the work, but it is very slow (around 30 secs. for a 960x1200 pixels image...).
Do any expert have a code to speed up this routine?
Thanks in advance,
Manuel López (lopem)