2005. augusztus 6., szombat

How to load and scale a JPEGImage into a TImage


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;

Nincsenek megjegyzések:

Megjegyzés küldése