开发者

How can I start showing an interlaced PNG before all data has been received?

I have a slow connection that I need to send a PNG image over (as a byte stream) and have the image be displayed immediately. I have a C# WinForms app accepting the byte[], loading it into a memory stream, and creating an System.Drawing.Image/Bitmap object from it.

What I would like to do is send a super low resolution image down, and then incrementally update it so that it gets clearer as the data is received. It looks li开发者_Python百科ke PNG supports interlaced images which do just what I want.

Is it possible to start showing the PNG before all the data is received and incrementally make it clearer as the rest of it comes in? How can I do this?


You'd have to deliver the bytes in such a way that they conform to the Adam7 algorithm. Possibly a 3rd-party library could be Googled that delivers the bytes in such a way to take the hard work out of it.

Here's a visual example of what it would do.

Edit: LibPNG for Windows might be a start. Of course its DLL would require your .NET program to interact with unmanaged code and non-MSIL assemblies, and that's another story that I'm sure is posted elsewhere on stackoverflow - or maybe you could create another question for it in particular. LibPNG is an open source project so looking at its source code might provide insight on the Adam7 algorithm that could be recoded in C#/.NET.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜