本文整理自网络,侵删。
procedure SaveAsJPG ;
var
jp: TJPEGImage; //Requires the "jpeg" unit added to "uses" clause.
begin
jp := TJPEGImage.Create;
try
with jp do
begin
jp.CompressionQuality := 2;
jp.Compress ;
Assign(Image1.Picture.Bitmap);
SaveToFile(''''D:\zhy.jpg'''');
end;
finally
jp.Free;
end;
////---读入方法如下:
procedure OpenJPGInImage
var
jp: TJPEGImage; //Requires the "jpeg" unit added to "uses" clause.
begin
jp := TJPEGImage.Create;
jp.LoadFromFile(''''D:\zhy.jpg'''');
try
with jp do
begin
image1.Picture.Bitmap.Assign(jp);
end;
finally
jp.Free;
end;
end;
相关阅读 >>
Delphi d10.x 在安卓app开发中使用jar包的注意事项
Delphi superobject json操作类的基本用法
Delphi 2009 之 tcategorypanelgroup[5]: headerstyle
更多相关阅读请进入《Delphi》频道 >>