本文整理自网络,侵删。
unit Unit1;
interface
uses Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics, Vcl.Controls, Vcl.Forms, Vcl.Dialogs, jpeg, Vcl.StdCtrls;
type TForm1 = class(TForm) btnBmp2Jpeg: TButton; procedure ConvertBMPtoJPG(SFileName, DFileName: string); procedure btnBmp2JpegClick(Sender: TObject); private { Private declarations } public { Public declarations } end;
var Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.btnBmp2JpegClick(Sender: TObject);begin ConvertBMPtoJPG('from.bmp', 'to.jpeg');end;
procedure TForm1.ConvertBMPtoJPG(SFileName, DFileName: string);Var J: TJpegImage; I: TBitmap; S, D: String;begin S := SFileName; D := DFileName; J := TJpegImage.Create; I := TBitmap.Create; I.LoadFromFile(S); J.Assign(I); I.Free; D := changefileext(D, '.jpg'); J.SaveToFile(D); Application.processmessages; J.Free;end;
end. 相关阅读 >>
Delphi2010中字符串汇编需要注意的一点,以及支持2010的aes加密库
如何在Delphi中禁用关于“返回值...可能未定义”的警告?
Delphi 获取适合微信使用的当前日期,以int64表示,是当前时间和1970-01-01 00:00:00之间的秒差
更多相关阅读请进入《Delphi》频道 >>