Search code examples
.netimagesystem.drawingmetafilewmf

Reliable .wmf/wmf to Pixel based image conversion


Good afternoon,

I am having a little trouble with .net's internal (System.Drawing) based MetaFile / Image handling of .wmf files that containt transparent areas. Basically whenever I do a MetaFile.LoadFile(...) and take that to save it as a tiff/png etc, some areas of that source files are missing. I can't really pin it down, but it -seems- like the vector based informations within the metafile just work fine, but the pixel-based areas (e.g. an image placed within the .wmf) are missing.

Does anyone know a reliable, .net native and non 3rd-party way to convert wmf files properly (as in.. the final pixel based image looks like the .wmf.. just.. well.. pixelated)?

Cheers and thanks, -J


Solution

  • Ok, well the apparently most reliably way to transform metafiles (.wmf/.emf) into another format is to use .png as output format, as somewhere in the msdn description metafiles are internally handled/transformed into png format anyway (with alpha etc) and e.g. a Metafile.Save("somewher"...) by default would output in png ImageFormat.

    So in case you do want to create a non-png image out of a Metafile input, you get the best result if you go the extra mile, transform & store it as a png, and take that png and re-transform it to your final format. Kinda lame, but then again.. wmf itself is weird anyway and I've come to the (my personal) conclusion it's evil. ;)

    -J