unit Main;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, Buttons, ExtCtrls,
  jpeg;

type
  TForm1 = class(TForm)
    Image1: TImage;
    Panel1: TPanel;
    BitBtn1: TBitBtn;
    BitBtn2: TBitBtn;
    BitBtn3: TBitBtn;
    procedure BitBtn1Click(Sender: TObject);
    procedure BitBtn2Click(Sender: TObject);
    procedure BitBtn3Click(Sender: TObject);

  private

  public

  end;

var
  Form1: TForm1;

implementation
{$R *.dfm}
{------------------------------------------------------------------------------}

procedure TForm1.BitBtn1Click(Sender: TObject);
begin
	Close();
end;

procedure TForm1.BitBtn2Click(Sender: TObject);
var
	fn  : String;
   jpg : TJPEGImage;

begin
	fn := 'trawa.jpg';

   try
      jpg := TJPEGImage.Create();
      if FileExists(fn) then
      begin
         jpg.LoadFromFile(fn);
         Image1.Picture.Bitmap.Assign(jpg);
      end;
   finally
		FreeAndNil(jpg);
   end;
end;

procedure TForm1.BitBtn3Click(Sender: TObject);
var
	fn  : String;

begin
	fn := 'kopia.bmp';
	Image1.Picture.Bitmap.SaveToFile(fn);
end;

end.

