c# - 无法将 tiff 图像转换为位图(矩阵)
问题描述
该函数GetBitMapColorMatrix
应该解码 tiff 图像并返回描述 tiff 图像的位图,但由于某种原因,我得到了这个异常 -> System.PlatformNotSupportedException: 'System.Drawing is not supported on this platform'
。任何帮助,将不胜感激。
public Color[][] GetBitMapColorMatrix(string bitmapFilePath)
{
Bitmap b1 = new Bitmap(bitmapFilePath);
int hight = b1.Height;
int width = b1.Width;
Color[][] colorMatrix = new Color[width][];
for (int i = 0; i < width; i++)
{
colorMatrix[i] = new Color[hight];
for (int j = 0; j < hight; j++)
{
colorMatrix[i][j] = b1.GetPixel(i, j);
}
}
return colorMatrix;
}
解决方案
UWP 不使用完整的 .net 框架,因此 System.Drawing 中的类不可用。它们是 System.Media.Imaging 命名空间中的一些类,如BitmapPallette和BitmapImage,它们可能很有用。我也会看看Win2D或SharpDX。
推荐阅读
- javascript - 使用 Javascript 更改 CSS 显示属性但不断消失
- sql - 如何验证配置文件何时分配给用户 Oracle 服务器
- python - 有没有更快的方法来判断两张图片是否不同?
- python - 如何一次按一下而不是按3次按钮?
- php - 自动化 git pull 在具有 cron 和 url 的服务器上不起作用
- c# - 将.cs文件的颜色分配给wpf中的solidcolorbrush
- cmake - Yocto 中未从生成的二进制文件中删除的调试符号
- eclipse - DPDK 开发人员使用哪个 IDE,他们如何调试代码?
- mxgraph - 是否可以更改 Edge 的 endArrow 的颜色?
- python - 在 pyspark 中通过检查加载数据框给了我空的数据框