标签:map 代码 manage finally surf str rem bit ssi
习惯VCL的做法了,到了FireMonkey里面,好像查不到单独的JPEG单元了,不少朋友就郁闷如何处理JPG了,这么大件事,不可能没有处理方法的,具体就请看代码:
uses FMX.Surfaces;
procedure TForm1.Button1Click(Sender: TObject);
var
Surf: TBitmapSurface;
Stream: TMemoryStream;
begin
Surf := TBitmapSurface.Create;
Surf.Assign(Image1.Bitmap);
Stream := TMemoryStream.Create;
try
TBitmapCodecManager.SaveToStream(Stream, Surf, ‘.jpg‘);
Stream.SaveToFile(ExpandFileName(‘~/Test.jpg‘));
finally
Stream.Free;
Surf.Free;
end;
end;
标签:map 代码 manage finally surf str rem bit ssi
原文地址:http://www.cnblogs.com/findumars/p/6351793.html