converting canvas into image

Jul 25, 2012 at 10:52 AM

Hi,

I am trying to convert canvas into image, it's working fine for me when there is only text in canvas but when I add image as a child of canvas it causing the error "Bitmap cannot accessed".

Here is my sample code:

ImageTools.ExtendedImage img = ImageExtensions.ToImage(cnv);

 

Please suggest, how can i convert my canvas into image.

 

Basically I need the memory stream of this image(canvas). Here is my sample code:

            ImageTools.ExtendedImage img = ImageExtensions.ToImage(cnv);
            MemoryStream mstream = new MemoryStream();
            JpegEncoder encoder = new JpegEncoder();
            encoder.Encode(img, mstream);
            mstream.Seek(0, SeekOrigin.Begin);

Please let me know, if there is any other way to do the same that will also support when image will be child of canvas.

Thanks.

Coordinator
Aug 8, 2012 at 9:41 AM

This is a security restriction with silverlight, when this image comes from another domain.

Jul 18, 2013 at 2:35 AM
How about you first use an OCR reader to extract the text and image out from the canvas, and save the text and image into the bitmap; or just use an prossional image converter application to convert the canvas to image directly.