Mega Code Archive

 
Categories / Delphi / Graphic
 

How to convert a Windows Meta file to a bitmap

Title: How to convert a Windows Meta file to a bitmap? Question: Convert WMF to BMP useing Timage... Answer: var DummyImage : TImage; DummyMetaFile : TMetaFile; X,Y : Integer; begin //Assumption: Image1 contains a WMF file //F.i. by: Image1.LoadFromFile('C:\XXX.WMF'); X := Image1.Picture.Width; Y := Image1.Picture.Height; DummyImage := TImage.Create(Self); DummyImage.Width := X; DummyImage.Height := Y; DummyImage.Canvas.Draw(0,0,Image1.Picture.Graphic); Image2.Picture := DummyImage.Picture; //Image2 now contains the bitmap DummyImage.Free; end;