当我尝试使用TiffBitmapDecoder读取.tif图像时,我收到了上述错误.我正在使用的代码是
using (Stream stream = new FileStream(filepath,FileMode.Open,FileAccess.Read,FileShare.Read)) { TiffBitmapDecoder decoder = new TiffBitmapDecoder(stream,BitmapCreateOptions.IgnoreImageCache,BitmapCacheOption.None); BitmapSource bitmapsource = decoder.Frames[0]; }
解决方法
您可以尝试
BitmapDecoder.Create()这允许您读取任何图像的流类型
using (Stream stream = new FileStream(filepath,FileShare.Read)) { BitmapDecoder decoder = BitmapDecoder.Create(stream,BitmapCacheOption.None); BitmapSource bitmapsource = decoder.Frames[0]; }
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。