我正在尝试使用c#.net将wmf图像文件转换为png格式.
但是,保存的图像不清楚,如下所示
我的代码:
Metafile img = new Metafile(@"test.wmf");
MetafileHeader header = img.GetMetafileHeader();
Bitmap bitmap = new Bitmap((int)(img.Width / header.DpiX * 100), (int)(img.Height / header.DpiY * 100));
using(Graphics g = Graphics.FromImage(bitmap)){
g.DrawImage(img, 0, 0);
}
bitmap.Save("test.png", ImageFormat.Png);
Run Code Online (Sandbox Code Playgroud)
我怎么能弄清楚?