procedure GetColorRatio( Bitmap: TBitmap; var R_Ratio, G_Ratio, B_Ratio: Extended );
var
x, y: Integer;
nR, nG, nB,nTotal: Integer;
aColor: TColor;
begin
with Bitmap do
for y:=0 to Height-1 do
for x:=0 to Width-1 do
begin
aColor := Canvas.Pixels[x,y];
Inc( nR, aColor and $FF );
Inc( nG, (aColor shr 8) and $FF );
Inc( nB, (aColor shr 16) and $FF );
end;
end;
nTotal := nR+nG+nB;
R_Ratio := nR*100.0/nTotal;
G_Ratio := nG*100.0/nTotal;
B_Ratio := nB*100.0/nTotal;
end;