问题描述
下午好,
我对基于.net内部(基于System.Drawing)的MetaFile/包含透明区域的.wmf文件的图像处理有些麻烦.基本上,每当我执行MetaFile.LoadFile(...)并将其保存为tiff/png等时,该源文件的某些区域就会丢失.我无法真正确定它的位置,但是-似乎-像图元文件中的基于矢量的信息一样工作正常,但是缺少了基于像素的区域(例如,放置在.wmf中的图像).
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.
有人知道可靠的.net本机和非第三方方法来正确转换wmf文件吗(例如,最终的基于像素的图像看起来像.wmf ..恰好..pixelated)?
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)?
欢呼和感谢,-J
推荐答案
好吧,将图元文件(.wmf/.emf)转换为另一种格式的最可靠方法似乎是使用.png作为输出格式,例如msdn描述图元文件无论如何都在内部进行处理/转换为png格式(使用alpha等),例如默认情况下,Metafile.Save("somewher" ...)将以png ImageFormat输出.
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.
因此,如果您确实想从图元文件输入中创建非png图像,则再加倍努力,变换&将其存储为png,然后将该png重新转换为最终格式.金达la脚,但是再说一次.. wmf本身还是很奇怪,我得出的(我个人的)结论是邪恶的. ;)
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
这篇关于可靠的.wmf/wmf到基于像素的图像转换的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!