procedure TForm1.Button1Click(Sender: TObject);
var
jp: TJpegImage; //Requires the "jpeg" unit added to "uses" clause.
MyStream :TStringStream;
begin
jp := TJpegImage.Create;
try
MyStream:=TStringStream.Create('');
try
with jp do
begin
Assign(Image1.Picture.Bitmap);
CompressionQuality:=50;//压缩比
SaveToStream(MyStream);
Table1.Edit;
.....
Table1.FieldByName('MyImage').Value:=MyStream.DataString;
Table1.Post;
end;
finally
MyStream.Free;
end;
finally
jp.Free;
end;
end;