CodePudding user response:
Create a TJPEGImage, read and then converted into BMP: code is as follows:procedure TSeleteImageFrm. Button3Click (Sender: TObject);
Var FileName: string;
JPG: TJPEGImage;
Bmp: TBitmap;
The begin
Panel1. BringToFront;
OpenPictureDialog1. InitialDir:=ImagePath;
OpenPictureDialog1. Filter:='open the image file (*.jpg) | *. JPG';
If OpenPictureDialog1. Execute then
The begin
FileName:=OpenPictureDialog1. FileName;
JPG:=TJPEGImage. Create;
Bmp:=TBitmap. Create;
Try
JPG. LoadFromFile (FileName);
BMP. Assign (JPG);
Image1. Picture. Assign (BMP);
Image2. Picture. Assign (BMP);
ChangeImageSize;
The finally.
JPG. Free;
Bmp. Free;
end;
end;
end;