procedure ConvertToGrayGraphic(var Bmp: TBitmap);
var
p ByteArray;
Gray,x,y :Integer;
begin
for y:=0 to Bmp.Height-1 do
begin
p:=Bmp.scanline[y];
for x:=0 to Bmp.Width-1 do
begin
Gray:=Round(p[x*3+2]*0.3+p[x*3+1]*0.59+p[x*3]*0.11); //这是转换公式
p[x*3]:=Gray;
p[x*3+1]:=Gray;
p[x*3+2]:=Gray;
end;
end;
end;