首页 > 解决方案 > 无法将 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;
    }

标签: c#uwpbitmaptiff

解决方案


UWP 不使用完整的 .net 框架,因此 System.Drawing 中的类不可用。它们是 System.Media.Imaging 命名空间中的一些类,如BitmapPalletteBitmapImage,它们可能很有用。我也会看看Win2DSharpDX


推荐阅读