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 xe6 android拨号函数

Delphi调用cmd并取得输出字符

Delphi webbrowser 加载html成web

Delphi压缩库 zlibex 介绍

Delphi遍历进程并获取进程路径

Delphi 让控制台窗口不现实出来

Delphi中隐藏程序进程

Delphi 查看字符串在不同编码(ascii、unicode、utf7、utf8、default、bigendianunicode)下的 hex

Delphi tdictionary 泛型如何排序

Delphi goto语句用法

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



打赏

取消

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

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

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

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

评论

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