简体   繁体   中英

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' . 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. Their are some classes like BitmapPallette and BitmapImage in the System.Media.Imaging namespace that could be useful. I would also look at Win2D or SharpDX .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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