简体   繁体   English

无法将 tiff 图像转换为 bitmap(矩阵)

[英]Can't convert tiff image to a bitmap (matrix)

The function GetBitMapColorMatrix is supposed to decode the tiff image and return a bitmap that describes the tiff image but for some reason, I get this exception -> System.PlatformNotSupportedException: 'System.Drawing is not supported on this platform' . function GetBitMapColorMatrix应该解码 tiff 图像并返回描述 tiff 图像的 bitmap 但由于某种原因,我得到了这个异常 - > System.PlatformNotSupportedException: 'System.Drawing is not supported on this platform' Any help would be appreciated.任何帮助,将不胜感激。

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 does not use the full .net framework so the classes in System.Drawing are not available. UWP 不使用完整的 .net 框架,因此 System.Drawing 中的类不可用。 Their are some classes like BitmapPallette and BitmapImage in the System.Media.Imaging namespace that could be useful.它们是 System.Media.Imaging 命名空间中的一些类,如BitmapPalletteBitmapImage ,它们可能很有用。 I would also look at Win2D or SharpDX .我也会看看Win2DSharpDX

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM