如何在 Silverlight 上显示 tiff 文件?
如何在 Silverlight 应用程序上显示 tiff 文件?我可以显示除 tiff 之外的任何图像格式,有人可以帮助我吗?谢谢。
How do I display tiff files on a Silverlight application? I can display any image format except tiff, can anyone help me? Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
我成功地在 Silverlight 中显示 TIFF。将免费的 LibTiff.NET 库移植到 Silverlight 很容易,只需 3需要 -4 个小调整。
该库本身非常传统,使用起来很原始,人们仍然需要了解 TIFF 格式的内部工作原理,以便能够按照需要的方式提取图像数据。
但它是可行的,然后可以将这些零碎的内容雕刻成
WriteableBitmap
。I was successful displaying TIFFs in Silverlight. It's easy to port the free LibTiff.NET library to Silverlight, just 3-4 minor tweaks required.
The library itself is quite legacy-like and raw to use and one still needs to have some knowledge about the inner workings of the TIFF format in order to be able to extract the image data the way one needs it.
But it's doable and the bits and pieces can then be chiseled into a
WriteableBitmap
.为什么不尝试TiffLight?它是一个 Silverlight 控件,允许在 Silverlight 中本机显示 Tiff 文件。
Why don't you try TiffLight? It is a Silverlight control that allows native display of Tiff files in Silverlight.
Tiff 文件是一种多页格式,因此渲染它不像 png、gif 或 bmp 那样简单。
您当然已经通过网络搜索找到了此,但这需要您付出代价。
A Tiff file is a multi-page format so rendering it is not as simple as a png, gif or bmp.
You have of course already found this via a web search but it'll cost you.
根据此,Silverlight 2.0 不支持 tiff 图像。
然而,在这篇文章中,我相信它解释了一种将 tiff 图像转换为 jpeg 或 png(Silverlight 支持)的方法。但是,您必须在服务器端进行此处理。
Silverlight 2.0 doesn't support tiff images according to this.
However, in the article I believe it explains a way to convert the tiff image to a jpeg or a png (which is supported by Silverlight). However, you'll have to do this processing on the server-side.
我将使用 HttpHandler 使用 TiffBitmapDecoder 和 PngBitmapEncoder 类。
或者,如果您可以在 Silverlight 中解码 Tiff 图像,则可以使用 WriteableBitmap。
I would use an HttpHandler that converts the Tiff using the TiffBitmapDecoder and PngBitmapEncoder classes.
Alternatively, if you can decode the Tiff images in Silverlight, you can display them using a WriteableBitmap.