1. 程式人生 > >Delphi中把bmp圖片轉換成jpg圖片

Delphi中把bmp圖片轉換成jpg圖片

//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;