Note: This is not recommended, as WMF is not a good way to store a raster file
procedure SaveBitmapAsWMF(Bitmap: TBitmap; const FileName: string);
var
Metafile: TMetafile;
MetafileCanvas: TMetafileCanvas;
begin
Metafile := TMetafile.Create;
try
Metafile.Enhanced := False; // True for EMF
Metafile.Width := Bitmap.Width;
Metafile.Height := Bitmap.Height;
MetafileCanvas := TMetafileCanvas.Create( Metafile, 0 );
try
// Draw the bitmap onto the metafile canvas
MetafileCanvas.Draw( 0, 0, Bitmap );
finally
MetafileCanvas.Free;
end;
Metafile.SaveToFile( FileName );
finally
Metafile.Free();
end;
end;
procedure TForm1.Button4Click(Sender: TObject);
begin
ImageEnView1.IO.LoadFromFile( 'D:\im.jpg' );
SaveBitmapAsWMF( ImageEnView1.IEBitmap.VclBitmap, 'D:\output.wmf' );
end;
Nigel
Xequte Software
www.imageen.com