Hi,
How can convert emf to bmp with delphi 2010?
Try something like:
var
bmp: TBitmap;
wmf: TMetafile;
bmp.SetSize(wmf.Width, wmf.Height);
bmp.Canvas.Draw(0, 0, wmf);
Use this code
procedure ConvertEMF2BMP(EMFFileName, BMPFileName: String) ;
var
MetaFile : TMetafile;
Bitmap : TBitmap;
begin
Metafile := TMetaFile.Create;
Bitmap := TBitmap.Create;
try
MetaFile.LoadFromFile(EMFFileName) ;
with Bitmap do
begin
Height := Metafile.Height;
Width := Metafile.Width;
Canvas.Draw(0, 0, MetaFile) ;
SaveToFile(BMPFileName) ;
end;
finally
Bitmap.Free;
MetaFile.Free;
end;
end;
If you want to draw the EMF with Anti-Aliaising, you can use our freeware SynGdiPlus library:
Gdip := TGDIPlusFull.Create;
MF := TMetaFile.Create;
MF.LoadFromFile(Files[Tag]);
Bmp := Gdip.DrawAntiAliased(MF,100,100); // 100% zoom in both axis
img1.Picture.Assign(Bmp);
The drawing is done using GDI+, so the rendering will be much better than the direct Canvas.Draw direct method. You could try to use basis anti-aliaising by stretching the bitmap to a smaller size, but in this case, the font rendering will be alterated. Our native GDI+ drawing produces better rendering quality. See http://synopse.info/forum/viewtopic.php?id=10