c# – 错误:“读取.tiff文件时,编解码器无法使用提供的流类型”

c# – 错误:“读取.tiff文件时,编解码器无法使用提供的流类型”,第1张

概述当我尝试使用TiffBitmapDecoder读取.tif图像时,我收到了上述错误.我正在使用的代码是 using (Stream stream = new FileStream(filepath,FileMode.Open,FileAccess.Read,FileShare.Read)) { TiffBitmapDecoder decode 当我尝试使用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];        }
总结

以上是内存溢出为你收集整理的c# – 错误:“读取.tiff文件时,编解码器无法使用提供的流类型”全部内容,希望文章能够帮你解决c# – 错误:“读取.tiff文件时,编解码器无法使用提供的流类型”所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/langs/1227056.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-06-05
下一篇 2022-06-05

发表评论

登录后才能评论

评论列表(0条)

保存