在C#中读取.tif文件

时间:2016-09-24 18:59:59

标签: c# image-processing bitmap tiff

我正在读取.tif文件以检索C#中的标头数据。但是当我尝试读取数据时,我会听到错误。

Stream imageStreamSource = new FileStream(filepath, FileMode.Open, FileAccess.Read, FileShare.Read);
TiffBitmapDecoder tiffdecoder = new TiffBitmapDecoder(imageStreamSource, BitmapCreateOptions.PreservePixelFormat, BitmapCacheOption.OnLoad);
BitmapSource firstframe = tiffdecoder.Frames[0];

编译器解析器第一行是非常合理的,但如果我查看对象,我看到了这个错误:ReadTimeout =' imageStreamSource.ReadTimeout'抛出类型' System.InvalidOperationException'和WriteTimeout =' imageStreamSource.WriteTimeout'抛出了#System; InvalidOperationException'。

类型的例外

和TiffBitmapdecoder抛出错误:编解码器无法使用提供的流类型。我是否使用了错误的类来解码?任何更好的方法来读取标题信息,然后解析图像上的一些符号非常感激。

0 个答案:

没有答案