Delphi bmp jpg 转换保存


本文整理自网络,侵删。

 
function BMPsaveJPGfile(bmp: TBitmap;jpgFilename:string;ACQ:integer):boolean;
Var
  jpg:TJpegImage;
  I:TBitmap;
  S,D:String;
begin
   result:=false;
  Jpg:=TJpegImage.Create;
  Jpg.Assign(bmp);
  Jpg.CompressionQuality := ACQ;
  Jpg.Compress;
  Jpg.SaveToFile(jpgFilename);
  Application.processmessages;
  Jpg.Free;
  if FileExists(jpgFilename) then
      result := True;
end;

function BMP2JPG(bmp: TBitmap;ACQ:integer):TJpegImage;
Var
  jpg:TJpegImage;
  I:TBitmap;
  S,D:String;
begin
  Jpg:=TJpegImage.Create;
  Jpg.Assign(bmp);
  Jpg.CompressionQuality := ACQ;
  Jpg.Compress;
  result:=jpg;
end;

//bmp图片转换成jpg图片
function fun_BmpToJpg(temp, path: String; ACQ: Integer): Boolean; stdcall;
var
  MyJpeg: TJpegImage;
  Bmp: TBitmap;
begin
  result := false;
  if FileExists(temp) then
  begin
    Bmp:= TBitmap.Create;
    MyJpeg:= TJpegImage.Create;
    Bmp.LoadFromFile(temp);
    MyJpeg.Assign(Bmp);
    MyJpeg.CompressionQuality := ACQ;
    MyJpeg.Compress;
    MyJpeg.SaveToFile(Path);
    MyJpeg.free;
    Bmp.free;
    if FileExists(path) then
      result := True;
  end;
end;

相关阅读 >>

Delphi的控制台程式添加公司信息、版权信息

Delphi tpicture 和 tbitmap 的相互转换

Delphi stringgrid 实例3: 本例功能: 1、修改 tstringgrid的默认宽与高; 2、添加行; 3、确认当前单元并赋值.

Delphi 压缩图片算法

Delphi rgb 画出三角形

Delphi mysql里Delphi事件类型转unix时间戳

Delphi 在电脑屏幕上显示图片

Delphi dll初始化和退出处理

Delphi cannot find implementation of method formcreate 解决办法

Delphi 在datasnap中使用firedac

更多相关阅读请进入《Delphi》频道 >>



打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...