Mega Code Archive

 
Categories / Delphi / Graphic
 

How to convert WMF to BMP

Title: How to convert WMF to BMP procedure WmfToBmp(const FileWmf, FileBmp: TFileName); var MetaFile: TMetafile; Bmp: TBitmap; begin Metafile := TMetaFile.Create; {Create a temporary Bitmap} Bmp := TBitmap.Create; {Load the Metafile} try MetaFile.LoadFromFile(FileWmf); {Draw the metafile in the Bitmap's canvas} with Bmp do begin Height := Metafile.Height; Width := Metafile.Width; Canvas.Draw(0, 0, MetaFile); {Save the BMP} SaveToFile(FileBmp); {Free BMP} Free; end; finally {Free Metafile} MetaFile.Free; end; end;