Having issues with saving canvas as image...

Nov 8, 2010 at 6:51 PM

Hello all,

I'm glad to have found this library!

I'm new to both Silverlight and development using Microsoft technology (Visual Basic) in general, so please excuse my ignorance. I have been wrestling with various methods to simply capture the Silverlight canvas and save as an image. I have reviewed the howto (http://imagetools.codeplex.com/wikipage?title=Write%20the%20content%20of%20a%20canvas%20to%20a%20file&ProjectName=imagetools) and other threads/examples to no avail. It appears the other examples use the 0.2 library (since the Image class is referenced); I have reviewed the release notes regarding 0.3, but I have not been successful in using ExtendedImage.

In my noobness, I seem to be receiving the error "'System.Windows.Controls.Grid' cannot be converted to 'ImageTools.ExtendedImage'" when trying to encode to jpeg from the IO stream.

Thank you.

Nov 9, 2010 at 9:55 PM
Edited Nov 9, 2010 at 9:57 PM

I fixed my issue - I was making this way too complicated! The conversion from C# to Visual Basic didn't go so well, but thanks to MarianoC, in thread http://imagetools.codeplex.com/Thread/View.aspx?ThreadId=234076, I was able to see my errors and resolve converting the canvas to an image, which was then sent to stream and encoded. Here's the correct line for converting the canvas to an image:

Dim myImage As ImageTools.ExtendedImage = ImageTools.ImageExtensions.ToImage(MyCanvas)

Dec 23, 2013 at 2:12 AM
Great! Just implement image saving method in .net appliation then we can save and store canvas in an random image format with a desired image storage saving path.

SaveImageFile(image As REImage, filePath As String, enc As BaseEncoder)