SVG exported to EMF loses precision, but exported as PNG looks fine

Posted on


I am Windows desktop programmer that needs to convert certain SVG into EMF in order to use it for programming.

My graphics design skills are at beginner level, but I have managed to convert SVG file into EMF successfully using Inkscape. However, the result is not looking as the original one, it is less “precise” so to say. If I export the SVG as PNG the result is the same as the original file. Unfortunately I need vector format that Windows recognizes and that is only EMF ( I am using pure WinAPI and C++, hence this limitation… ).

To see exactly what I mean, link to original SVG, and EMF and PNG that I made is here. Just click on the Download:test.rar above the 5 yellow stars ( see picture below ).

enter image description here

The problem seems to be the dimensions of the EMF file ( it should be 90 x 120 ) as the picture is crystal clear when I resize my application to bigger dimensions.

I am asking your help to get the same graphic quality of the EMF file as the original SVG.

To further help you in your efforts to solve my problem, here is a small application that will display EMF in a window. Just keep the EMF in the same place the application is, and name the EMF as test.emf.

Thank you for your time and efforts. Best regards.


I’ll make a comparison with your test graphic:

  1. This is the PNG file you provide, so this probably is the desired result:

    enter image description here

  2. The output of your code, approx. at the same size:

    enter image description here

  3. The EMF file you provide, displayed in IrfanView (again approx. the same size)

    enter image description here

  4. Same as 3., but with View -> Display Options -> Use Resample turned on:

    enter image description here


As 4. look similar to 1. (i.e. the desired result), my conclusion is that the conversion to EMF format is perfectly fine, but your code scales the graphic with a simple, probably pixel based algorithm. So IMHO you need to implement e.g. a bilinear interpolation routine.

When viewed with Photoshop, the EMF does not have an added frame, so this seems to be a problem with the viewer.

Not able to download your viewer for some obscure reason,
I have used the Free WMF Viewer to view your EMF image,

The EMF file looks perfect – it scales up and down perfectly as should a vector graphics image. But that viewer also shows a black frame around the image.

I have also viewed your EMF using
an old wmf/emf viewer that I have once written, which also doesn’t show the black frame.
I remark that in my own viewer I have used the bounding box only to determine the aspect
ratio of the image (height vs. width), so as to display it correctly,
meaning not squashed or stretched.

My conclusion is that both viewers display the bounding box as a frame.
This is incorrect, since its purpose is to give information about the image’s
recommended viewing rectangle, rather than be displayed.
Your process of generating the EMF seems therefore to be correct.

Leave a Reply

Your email address will not be published.