TJPEGImageAssign (Delphi)
Description
This example converts a bitmap image to a jpeg file by using the Assign method. This example requires a button and two images. One image must have its Picture property loaded with a bitmap at design time.
Code
uses Jpeg;
procedure TForm1.Button1Click(Sender: TObject);
var
jp: TJPEGImage; //Requires the jpeg unit added to the uses clause.
begin
jp := TJPEGImage.Create;
try
with jp do
begin
Assign(Image1.Picture.Bitmap);
SaveToFile('factory.jpg');
Image2.Stretch := True;
Image2.Picture.LoadFromFile('factory.jpg');
end;
finally
jp.Free;
end;
end;
Uses
- Vcl.Imaging.jpeg.TJPEGImage.Create ( fr | de | ja )
- Vcl.Imaging.jpeg.TJPEGImage.Assign ( fr | de | ja )
- Vcl.Graphics.TGraphic.SaveToFile ( fr | de | ja )
- Vcl.ExtCtrls.TImage.Stretch ( fr | de | ja )