我正在尝试使用 WIC 将图像编码为隔行扫描的 png。我可以毫无问题地将图像保存为 png 并设置隔行扫描模式。但是,如果我尝试设置过滤器模式(任何过滤器),我会收到以下错误:
[System.Runtime.InteropServices.COMException] = {"The bitmap property type is unexpected. (Exception from HRESULT: 0x88982F8E)"}
我是否以错误的方式设置了属性包的值?这是代码,propBag.Write 处抛出异常。
[...]
var arg = new IPropertyBag2[1];
encoder.CreateNewFrame(out outputFrame, arg);
var propBag = arg[0];
var propertyBagOptions = new PROPBAG2[2];
propertyBagOptions[0].pstrName = "InterlaceOption";
propertyBagOptions[1].pstrName = "FilterOption";
propBag.Write(2, propertyBagOption1, new object[] { true, WICPngFilterOption.WICPngFilterAdaptive});
[...]
感谢您的帮助,斯蒂芬妮