Delphi BMP 转换JPG


本文整理自网络,侵删。

 
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.

相关阅读 >>

Delphi内嵌汇编实现�载任意进程的某个dll

Delphi timage 加上滚动条方法

Delphi中如何向某个ip不间断的发送数据

Delphi 单元文件结构

Delphi Delphi copy,pos,delete win api 版

Delphi xe vcl - tlinklabel(链接标签)

Delphi fmx 切换窗体最大化

Delphi 如何清空image1

Delphi 使用windows api(wincrypt)计算文件md5哈希,支持大文件

Delphi api: setwindowpos改变窗口的位置与状态

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



打赏

取消

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

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

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

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

评论

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