1
0
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 ).
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.
1"to get the same graphic quality of the EMF file as the original EMF"? Aren't the originals SVGs... – martineau – 2014-08-03T15:05:15.333
@martineau: I meant "as the original SVG"... I have edited my post. Thank you for your correction. – AlwaysLearningNewStuff – 2014-08-03T16:22:59.080
The "precision" issue may be inherent in the EMF format (or an limitation of Inkscape's export_to_EMF functionality). You might be able to work around it by exporting the SVG files at a higher resolution (like double) and then scaling it back down when you place them using the WinAPI. – martineau – 2014-08-03T16:51:49.833
@martineau: The "precision" issue may be inherent in the EMF format -> this may well be the case because even online converters produced the same result. You might be able to work around it by exporting the SVG files at a higher resolution -> you mean if I want 100 x 100 image then I would need at least 200 x 200 SVG? – AlwaysLearningNewStuff – 2014-08-03T17:06:04.110
Yes, that's what I meant. You should be able to scale it back down to the original size when you place it using Windows' API. – martineau – 2014-08-04T01:36:08.073
@martineau: I have tried scaling it to 200 x 200 but had no success. Then I have tried to scale it up to 800 x 800 but again it failed. Finally I tried with 600 x 600 but again no luck... I went to Object->Transform and chose Scale from the dialog box in Inkscape. I even tried with Apply to each object separately option but it did not helped me either... Maybe I am doing something wrong, can you try to do what you suggest with the SVG I linked to in my post? Thank you. – AlwaysLearningNewStuff – 2014-08-04T11:21:16.100
What do you mean by "had no success" and "it failed"? After you do that with everything in the SVG file, export it again, and the try accessing it with WinAPI and C++ again? – martineau – 2014-08-04T13:24:05.913
@martineau: What do you mean by "had no success" and "it failed"? -> the quality of the picture remained the same. After you do that with everything in the SVG file, export it again, and the try accessing it with WinAPI and C++ again? After scaling up the image, I click Save to save the changes, then Save as and save it as EMF. The quality of the image remains unchanged. I have noticed the same when Explorer displays the image. Inkscape gave the warning that some details might be lost when closing the program and asked to save as SVG instead EMF. Perhaps last part is important? – AlwaysLearningNewStuff – 2014-08-04T13:34:22.100
It's quite possible that when you save the file as EMF it gets converted into an image -- EMF files can contain embedded raster images as well as vector graphics. For the highest quality and consistency, I suggest you try to figure out some way to use the original SVG graphics rather than converting them. – martineau – 2014-08-04T16:56:47.207
Only one difference between the provided SVG and EMF catched my eye: In the former you do not have a black outline of e.g. the white waves, but in the latter you have. This outline isn't scaled down, hence messing up your EML at small scales. As I'm not completely sure, we are talking about the same issue (some graphics in your question would be helpful), please check out my edited EMF file: http://www.speedyshare.com/zBS7q/test-mod.emf -- if that looks fine, perhaps you can find an Inkscape export option concerning the outline (I don't know Inkscape... I used CorelDRAW to produce this file).
– mpy – 2014-08-05T18:36:57.803@mpy: I have checked your EMF and got same result. If you could please be patient I will code a small application that will help you with testing and will upload it. I will edit my post with the link for this application and notify you. Thank for trying to help, I appreciate it! – AlwaysLearningNewStuff – 2014-08-05T18:45:40.867
Wouldn't it be easier just to post two images (desired result and result from your code? – mpy – 2014-08-05T18:51:33.953
@mpy: Done! See my edited post for the link. Don't forget to follow simple instructions so everything can work properly. – AlwaysLearningNewStuff – 2014-08-05T19:03:57.287
(Your link to the EMF viewer program is bad.) I agree that there is nothing wrong with your EMF. When viewed with Photoshop the EMF does not have an added frame, so this seems to be a problem with your viewer. – harrymc – 2014-08-05T20:36:45.380
@harrymc: Your link to the EMF viewer program is bad. I don't understand, have you clicked on
Download:EMF app.rar
just above 5 yellow stars? Did you keep the EMF file and program at the same place e.g. in the same directory? When viewed with Photoshop the EMF does not have an added frame, so this seems to be a problem with your viewer I don't understand this part, but I believe you. Can you explain what you mean ( if it is not too broad of course )? Thank you. – AlwaysLearningNewStuff – 2014-08-05T20:42:38.8701I think this was a momentary glitch with the sharing site, the link works fine now. – harrymc – 2014-08-05T20:51:06.583
@harrymc: OK, no problem. It seems that answer below sheds some useful light. I am using native
GDI
and it probably does use simple scaling algorithm. I just don't understand why do I need resampling algorithm when EMF is vector format... – AlwaysLearningNewStuff – 2014-08-05T20:54:21.993