PNG From Canvas

Jan 13, 2010 at 1:45 PM

Hi, I need to save a silverlight canvas to a PNG File in the server.

Below are the steps that need to happen:

1. Change the canvas to PNG
2. Show the generated PNG to the user to confirm his design (By generating a writable bitmap from the PNG)
3. After the user confirms, pass PNG as byte array to a webservice
4. Change the byte array to PNG File and save it in the server.

Can anyone help me with this? I've been stuck with this issue..

Thanks a lot in advance.

Jan 13, 2010 at 2:53 PM

Ok I managed to do step 1-3.

I use Image Tools PNG Encoder to encode my canvas to a memory stream, and then create a byte array from it.

And now my problem is on how to save the byte array to a png file in the server?

I tried using filestream, the file was created, but when i try to open it, it said something's wrong about the file format.

Anyone knows how to fix this? Thanks.

 

May 17, 2011 at 11:49 AM

how do you create PNG out of the canvas?

Coordinator
May 23, 2011 at 8:25 AM

http://imagetools.codeplex.com/wikipage?title=Write%20the%20content%20of%20a%20canvas%20to%20a%20file