none
请教关于用BitmapDecoder 解码bmp图片报错的问题 RRS feed

  • 问题

  • 大家好,我想请教一下关于用BitmapDecoder解码png和bmp图片报错的问题,代码如下:

    Guid decoderId;
                switch (file.FileType.ToLower())
                {
                    case ".jpg":
                    case ".jpeg":
                        decoderId = Windows.Graphics.Imaging.BitmapDecoder.JpegDecoderId;
                        break;
                    case ".bmp":
                        decoderId = Windows.Graphics.Imaging.BitmapDecoder.BmpDecoderId;
                        break;
                    case ".png":
                        decoderId = Windows.Graphics.Imaging.BitmapDecoder.PngDecoderId;                   
                        break;
                    default:
                        return;
                }
                Windows.Graphics.Imaging.BitmapDecoder decoder = await Windows.Graphics.Imaging.BitmapDecoder.CreateAsync(decoderId, stream);

                当执行到最后一句话时,会报错说“图片格式未知”,如果是bmp的图片就会报这个错误,请问该如何解决

    2012年8月17日 8:04

答案

全部回复