如何解决无法将 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。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。