An unclear converted image. wmf to png?

The . Wmf file has extremely large values for DpiX/Y. You'll need to rescale the image to make it a better fit with the resolution of your monitor.

This code produced a decent looking version of the metafile. You may want to tweak the scaling to fit your need or rescale the bitmap afterwards.

Up vote 0 down vote favorite share g+ share fb share tw.

I'm trying to convert wmf image file into png format with c#.net. But, saved image is unclear as you can see below yfrog.com/ochql9p my code: 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); How could I get it clear? C# png gdi+ wmf link|improve this question edited Nov 1 '11 at 1:55John Saunders86.7k763144 asked Oct 31 '11 at 9:19turutosiya12.

Have you tried g. InterpolationMode? – L.

B Oct 31 '11 at 9:29 Thanks L.B. but I can't find difference. – turutosiya Oct 31 '11 at 10:20 result: link – turutosiya Oct 31 '11 at 10:34 Please don't add stuff like " (c#. Net)" to your titles.

On Stack Overflow, we use tags for that purpose. – John Saunders Nov 1 '11 at 1:56 @JohnSaunders thannk you for your advise. Ok.

– turutosiya Nov 1 '11 at 3:38.

The . Wmf file has extremely large values for DpiX/Y. You'll need to rescale the image to make it a better fit with the resolution of your monitor.

This code produced a decent looking version of the metafile. You may want to tweak the scaling to fit your need or rescale the bitmap afterwards: using (Metafile img = new Metafile(@"c:\temp\test. Wmf")) { MetafileHeader header = img.

GetMetafileHeader(); float scale = header. DpiX / 96f; using (Bitmap bitmap = new Bitmap((int)(scale * img. Width / header.

DpiX * 100), (int)(scale * img. Height / header. DpiY * 100))) { using (Graphics g = Graphics.

FromImage(bitmap)) { g. Clear(Color. White); g.

ScaleTransform(scale, scale); g. DrawImage(img, 0, 0); } bitmap. Save(@"c:\temp\test.

Png", ImageFormat. Png); } }.

Thanks. But nothing happened link – turutosiya Oct 31 '11 at 11:31 You are tinkering with the wrong setting, it is Graphics.SmoothingMode. It is otherwise unclear what's in the .wmf.

If it is a bitmap instead of a line drawing then you cannot improve what is already there. – Hans Passant Oct 31 '11 at 11:46 I've tired g. SmoothingMode = SmoothingMode.

HighQuality, ,, still same. You can get the . Wmf from here : goo.

Gl/CTJ40. – turutosiya Oct 31 '11 at 13:35 Adobe Illustrator can render that . Wmf realy clear.

You can see how it will be displayed with Illustrator here: yfrog.com/ochql9p – turutosiya Oct 31 '11 at 13:37 The file is strange, it has extremely large values for DpiX/Y. It seems to contain text that was flattened to curves. Post updated.

– Hans Passant Oct 31 '11 at 14:45.

Finally, I got an IDEA! That is to use Inkspace. As you all know, Inkscape is an Vector Graphics Editor.

Today, I found out that INKSCAPE HAS COMMAND LINE OPTIONS! http://goo. Gl/Moksf .

So, what I should do is to call incape. Exe with some options, such like: Process. Start("inkscape.

Exe -f {wmf_filename} -e {png_filename_to_be_made}"); Here is converted png file : yfrog.com/gyu40ap very clear png image. That is what I wanted to! Thank you!

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions