6

If I have a wmf or emf image in System.Drawing.Image, is there a way to save the metafile data with c# without rendering it as a bitmap? Calling Image.Save will render it to a bitmap and I want to keep the original data so that it would still be a valid .wmf or .emf format file.

skaffman
  • 398,947
  • 96
  • 818
  • 769
Chris Miller
  • 4,809
  • 4
  • 33
  • 50
  • possible duplicate of [GDI+ / C#: How to save an image as EMF?](http://stackoverflow.com/questions/152729/gdi-c-how-to-save-an-image-as-emf) – finnw Sep 27 '11 at 11:44

3 Answers3

4

Despite this MSDN page, it is possible to save a true EMF file. See this question: gdi-c-how-to-save-an-image-as-emf

Community
  • 1
  • 1
Han
  • 2,017
  • 17
  • 23
2

It is possible to save a metafile in its orignal format if you use the gdi32.dll.

I am using the method described here and it works fine.

Kildareflare
  • 4,590
  • 5
  • 51
  • 65
2

It seems you can not.

On this MSDN page, it is stated:

Remarks

When you use the Save method to save a graphic image as a Windows Metafile Format (WMF) or Enhanced Metafile Format (EMF) file, the resulting file is saved as a Portable Network Graphics (PNG) file instead. This behavior occurs because the GDI+ component of the .NET Framework does not have an encoder that you can use to save files as .wmf or .emf files.

H H
  • 263,252
  • 30
  • 330
  • 514