WPF Image control to progressively load multipage

2019-02-24 03:39发布

问题:

I'm wondering if there's an existing control or if it would be straightforward to develop a control allowing a multipage tiff to be progressively loaded over a network? I'm working with some tiff images that are up to thousands of pages, and it would be great to have the image start to appear as soon as a page or pages are downloaded, and only retrieve additional pages of the image as needed, or download on demand or when bandwidth is available. I realise that a TIFF image has certain structural requirements and surrounding metadata, but expect that this should be possible.

回答1:

I suggest you start using LibTiff or LibTiff.NET. This last one is easy to start with and I have good experiences so far. It will allow you full control over the order of loading. It does depend somewhat on the exact formatting of the tiff you're trying to load. Random access to pages is always possible. Furthermore it will give you good control over memory resource usage.

The previous advice to start with the specification is imho a recipe for a nightmare. There are so many different interpretations of TIFF (including byte ordering dependent on the machine) that you'll spend a lot of time implementing and testing. The LibTIFF is the reference and it has a very mild license form. Please check my question on StackOverflow here



回答2:

I don't think any language has a control for this natively. I would grab a copy of the TIFF specification and write my own solution.

http://partners.adobe.com/public/developer/tiff/index.html

You may want to try and adapt existing TIFF viewer controls, however:

http://www.codeproject.com/KB/miscctrl/Image_Viewer_Control.aspx; http://www.atalasoft.com/cs/forums/thread/11473.aspx

I can't vouch for the quality of the above code, however.