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 mediaplayer1 播放avi 视频

Delphi winapi: isiconic、iszoomed - 分别判断窗口是否已最小化、最大化

Delphi findfiles获取目录下所有文件

Delphi 使用int3进行hook处理

Delphi 时间与相关类型(3): tfiletime、tsystemtime 及 dos 时间

Delphi中三种方法获取windows任务栏的高度

Delphi 比较版本号

Delphi 向其他程序发送模拟按键

Delphi实现解析百度搜索结果link?url=

Delphi 在win32程序中显示dos调试窗口

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



打赏

取消

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

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

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

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

评论

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