WindowsImagingComponent或System.Windows.Media.Imaging

时间:2011-09-27 00:47:50

标签: windows bitmap imaging wic

我需要在托管代码中使用一些位图并将它们保存为PNG文件。我应该使用Microsoft.WindowsAPICodePack.DirectX.WindowsImagingComponent还是System.Windows.Media.Imaging?它们看起来非常相似,我不确定为什么我会选择一个而不是另一个。有人可以比较和对比吗?

2 个答案:

答案 0 :(得分:1)

他们都使用WIC,这就是他们如此相似的原因。 Windows API代码包是已废弃的内容,您将需要使用WPF命名空间,因为它在.NET 3及更高版本上可用,并且不需要单独安装。

答案 1 :(得分:0)

Microsoft.WindowsAPICodePack.DirectX.WindowsImagingComponent位于Windows API代码包中,这是您需要在应用程序中构建的源代码库。另一方面,System.Windows.Media.Imaging包含在.NET Framework中。

如果您没有其他用途的Windows API代码包,我建议使用System.Windows.Media.Imaging。我相信在Windows API代码包中包含WIC API主要是为了与代码包中的DirectX API进行互操作,而在.NET Framework中没有等效的。