请看如下代码
var
i,j,k, nRed, nGreen, nBlue: integer;
begin
i:=5, j:=5;
//读像素
nRed := GetRValue(ColorToRGB(Image1.Canvas.Pixels[i,j]));
nGreen := GetGValue(ColorToRGB(Image1.Canvas.Pixels[i,j]));
nBlue := GetBValue(ColorToRGB(Image1.Canvas.Pixels[i,j]));
//写像素
Canvas.Pixels[i+320,j] := RGB(nRed ,nGreen,nBlue);
end;
如何保存为JPG格式
procedure TfrmColor.Button12Click(Sender: TObject);
var
jpg : TJpegImage;
begin
jpg := TJpegImage.Create;
jpg.Assign( image1.picture.bitmap );
// Here you can set the jpg object's properties as compression, size and more
jpg.SaveToFile ( './picture.jpg' );
Application.MessageBox('已经将图片以JPG格式存放在当前目录的picture.jpg文件中', '完成',MB_OK);
jpg.Free;
end;