在图像显示之前,我需要对它进行灰度缩放。图像来自服务器。我使用BitmapImage作为图像的Source。我可以用BitmapImage显示图像。
现在我需要灰度图像,因为我发现可以使用WritableBitmap将其转换为灰度。我用WritableBitmapEx.WinRT库做灰度。
但问题是,我无法将BitmapImage转换为WritableBitmap in WinRT。
欢迎任何建议。
谢谢
发布于 2016-03-19 19:19:47
首先使用WriteableBitmap而不是BitmapImage。除了访问PixelBuffer之外,它们的使用几乎是相同的。
不能直接从BitmapImage中提取像素。将BitmapImage“转换”为WritableBitmap的所有合理方法都从原始源获取数据。如果您无法获得原始的UriSource (因为您是从流中加载的),并且无法从流中重新加载流,那么您就倒霉了。
惟一的其他(丑陋)选项是用RenderTargetBitmap快照图像
https://stackoverflow.com/questions/36082404
复制相似问题