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 优盘背景生成器源码

Delphi 判断字符串是否为纯字母组合

Delphi 用updateresource修改exe文件图标(已修正)

Delphi hash类

Delphi xmldocument控件之xml

Delphi关闭进程

Delphi bmp转换png

Delphi webbrowser.oleobject属性

Delphi memo控件对粘贴板的支持

windows7下使用Delphi7的方法

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



打赏

取消

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

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

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

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

评论

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