Uses
jpeg,, ExtCtrls, axCtrls,
procedure
TForm1.convertobmp(filename: TFileName);
Var
OleGraphic : TOleGraphic;
fs
: TFileStream;
Source
: TImage;
BMP
: TBitmap;
Begin
Try
OleGraphic := TOleGraphic.Create; //The
magic class!
fs := TFileStream.Create(filename,
fmOpenRead Or fmSharedenyNone);
OleGraphic.LoadFromStream(fs);
Source := Timage.Create(Nil);
Source.Picture.Assign(OleGraphic);
BMP := TBitmap.Create; //Converting to
Bitmap
bmp.Width := Source.Picture.Width;
bmp.Height := source.Picture.Height;
bmp.Canvas.Draw(0, 0,
source.Picture.Graphic);
img5.Picture.Bitmap := bmp; //Show the
bitmap on form
img5.Refresh;
fs.Free;
OleGraphic.Free;
Source.Free;
bmp.Free;
Finally
End;

إرسال تعليق