我需要使用WPF查看多页tiff。
我目前有以下内容:
<FlowDocumentReader>
<FlowDocument>
<BlockUIContainer>
<Image x:Name="DocImg" Source="test1752158790.tif" />
</BlockUIContainer>
</FlowDocument>
</FlowDocumentReader>
我只能查看第一页。
有办法做到这一点吗?
谢谢! 托德
答案 0 :(得分:4)
如another问题所述,请使用TiffBitmapDecoder。
这样的事情:
// Decode TIFF image
ImageStream = new FileStream(EnvelopeItem.LocalImagePath, FileMode.Open, FileAccess.Read, FileShare.Read);
ImageDecoder = new TiffBitmapDecoder(ImageStream, BitmapCreateOptions.PreservePixelFormat, BitmapCacheOption.Default);
PageImage.Source = ImageDecoder.Frames.FirstOrDefault();
不要处理流,直到你完成了用图像显示你的帧。
答案 1 :(得分:3)
我会在后面实现你自己的控制代码。您将需要一些用户输入来指示用户何时从一个页面转到下一个页面,无论是通过鼠标点击还是其他任何页面。
一旦获得该用户输入,您就可以显示tiff的不同页面。正如在ChrisF使用的问题中所说,我会使用libtiff,更具体地说,.NET包装器FreeImage,它很好地封装了.NET的tiff功能。