Recent Posts
Selamat datang di Coding Delphi Land Weblog kumpulan source code pemogram delphi
(Bukan maksud untuk menggurui tetapi marilah kita berbagi ilmu tuk perkembangan kemajuan teknologi kita
Senin, 16 November 2009
Convert Jpeg To BMP
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs,JPEG, ExtCtrls, StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
Button2: TButton;
OpenDialog1: TOpenDialog;
SaveDialog1: TSaveDialog;
Image1: TImage;
Label1: TLabel;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
JPEGImage: TJPEGImage;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
begin
JPEGImage:=TJPEGImage.Create;
if OpenDialog1.Execute then
begin
JPEGImage.LoadFromFile(OpenDialog1.FileName);
Image1.Canvas.Draw(0,0,JPEGImage);
end;
end;
procedure TForm1.Button2Click(Sender: TObject);
var
Bitmap: TBitmap;
begin
try
Bitmap:=TBitmap.Create;
with Bitmap do
begin
PixelFormat:=pf24bit;
Height:=JPEGImage.Height;
Width:=JPEGImage.Width;
Canvas.Draw(0,0, JPEGImage);
end;
if SaveDialog1.Execute then
Bitmap.SaveToFile(SaveDialog1.FileName);
Label1.Caption:='Convertation finised';
finally
Bitmap.Free;
JPEGImage.Free;
end;
end;
end.
0 komentar:
Posting Komentar