views:

118

answers:

1

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 like 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?

+2  A: 

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.

John K
Thanks, I was hoping for a more *automatic* solution, I guess there isn't one :(
NotDan
Me too. It seems odd there isn't an implementation that's easily googleable. Maybe you will be the first.
John K