Mirror

How to load and scale a JPEGImage into a TImage (Views: 100)


Problem/Question/Abstract:

How to load and scale a JPEGImage into a TImage

Answer:

{ ... }
Image1.Picture.Graphic := nil;
try
  Image1.Picture.Graphic := nil;
  Image1.Picture.LoadFromFile(jpegfile);
except
  on EInvalidGraphic do
    Image1.Picture.Graphic := nil;
end;
if Image1.Picture.Graphic is TJPEGImage then
begin
  TJPEGImage(Image1.Picture.Graphic).Scale := Self.Scale;
  TJPEGImage(Image1.Picture.Graphic).Performance := jpBestSpeed;
end;

<< Back to main page