Clipboard-ról JPG-be

A következő példa a Jpg képek használatát is bemutatja, kell hozzá egy edit1.-komponens...

uses clipbrd, jpeg
...
procedure TForm1.Edit1KeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
var
jpg:Tjpegimage;
begin
if key=vk_return then
begin
if clipboard.HasFormat(cf_picture)or clipboard.HasFormat(cf_bitmap)or
clipboard.HasFormat(cf_metafilepict) =true then
begin
clipboard.Open;
image1.Picture.Assign(clipboard);
clipboard.Close;
jpg:=Tjpegimage.Create;
jpg.Assign(image1.picture.Graphic);
jpg.SaveToFile('c:\'+edit1.Text+'.jpg');
jpg.free;
end else edit1.Color:=form1.Color;
end;
end;