Skip to main content
Home Forums General Silverlight New Features in Silverlight 3 Request for getting binary from Canvas/Image Control
13 replies. Latest Post by jo2fong on June 7, 2009.
(0)
jo2fong
Member
2 points
12 Posts
06-04-2009 1:23 PM |
It is so disappointed that SL does not support saving drawing on image/canvas....to jpeg..............................................
ksleung
Contributor
5366 points
1,028 Posts
06-04-2009 1:45 PM |
When SL3 RTW comes out hopefully we can save a control to a WriteableBitmap and then to a byte stream, assuming the original content is not a security risk. Then, we can convert the byte stream to a Jpeg file using a 3rd party tool such as FJCore. Right now, you can save a control to a WriteableBitmap but the bitmap is not readable (except to be used as an image source).
MarkMonster
5220 points
1,046 Posts
06-04-2009 2:22 PM |
I guess we will have to wait until July 10.
06-04-2009 9:01 PM |
i am developing application that would perform some drawing features on images...such draw text annotation..i can draw the text...on image/canvas...but no way to save the content back to jpeg/png files....so disappointed...i will give up in exploring SL...
06-04-2009 9:03 PM |
Don't give up, wait for another month
06-05-2009 2:46 AM |
I heard that SL3 still not support getting binary from Image/Canvas control....In addition, Microsoft Silverlight Product Team seem not take developers' voice into consideration as I saw there is alot of votes on requesting printing feature and binary from from silverlight control...,but it seem these voice are ignored until SL 4I am turning into Adobe Flex 3 now...
06-05-2009 3:06 AM |
I definitely don't feel like that. The Silverlight product team is reading the forums very often as I heard. And also don't forget the very tight schedule they are working on.
Silverlight 2 RTW: 2008-10-14
Silverlight 3 RTW: 2009-07-10
Just 9 months. Don't know if they will keep this speed in releasing, but they definitely put a lot of new things in SL3. Where did you hear that SL3 will not support getting binary from image/canvas control? Almost everyone (not always directly related to Microsoft) tell me it will probably be there because they think WritableBitmap is very useless without it.
Yes printing will take some time, but I also consider this one a very difficult one. Because all the advanced layouts that are possible on the screen, do we want this kind of thing on paper? Not just possible, but I don't know how Flex solved that.
Hope you'll stick at SL :-).
06-05-2009 4:10 AM |
I totally agree with Mark Monster. And in my earlier reply, I already spelt out how to do that what the one tiny little feature which I shall call WriteableBitmap security issue is resolved. The Silverlight team knows about this issue from the beginning and I ad many others had raised this important issue many times. I am sure this is important to them as well. One of the SL team member did say that this will be available in SL3 RTW, just that the exact detail about the security criteria has not been announced. But comes SL3 RTW I definitely think you will be able to convert your drawings to Jpg... Actually you can even do it today, just that you need to following a different (and more difficult) route that's all.
06-05-2009 12:20 PM |
I really thank for all you guys from heart!!! sorry for my bad temper in previous post.In fact, i also a .net lovers, however, i have to submit my prototype on jul and may not be able to wait for Silverlight.The most difficult part for me is that i cant save my drawing on canvas/image to jpeg control in SL 2.i know we can submit XAML of SL to WCF and convert it to binary using WPF...but it is a bit indirect,slow performance and sometime inaccurate result.In addition, i saw from posts in forum saying that SL3 also does not support getting binary from control and can't save drawing. Therefore, i tend to NOT put it into SL platform.
06-05-2009 11:17 PM |
is there any way that we could have a try of the mentioned features? i.e. get binary from image/canvas control in SL3 RTW?
06-05-2009 11:32 PM |
You'd need to wait to the release (presumably July 10th). Unless there is an interim Release Candidate, it will be impossible to mimick or simulate the conversion even in the simplest setting.
Only thing you want to do is to set up your application so that it can convert a *readable* WriteableBitmap to Jpeg, since this step will not be provided by Silverlight even in SL3 RTW. For now the only time a WriteableBitmap is readable only when it has never been "Render()" into.
06-06-2009 1:00 AM |
i am confused after readin the reply.what is want to do is...i draw sth on image/canvas control such as drawing text, drawing line..etcCan i save the image with drawn text and annotation to jpeg in SL3 RTW?
06-06-2009 1:22 AM |
Supposedly, with some more work, YES.
The workflow to export Jpeg looks like this.
(1) Create a WriteableBitmap, take the image/canvas control, and call WriteableBitmap.Render() to render the content to the WriteableBitmap. Now WriteableBitmap contains the pixels you want.
(2) Convert the WriteableBitmap to a byte array for processing in the next step
(3) Implement a new or use an existing C# Jpeg encoder, which takes a byte array reprensetation and convert into another byte array representation of the Jpeg.
In SL3 beta:
(1) is already supported(2) is not supported because of the DRM issue. Once the Render() function is called, the WriteableBitmap becomes unreadable.(3) is not natively supported but it can be done
In SL3 RTW:
(1) is already supported (SAME AS ABOVE) (2) should be supported for non-DRM-violating scenario (3) is not natively supported but it can be done (SAME AS ABOVE)
06-07-2009 1:16 AM |
there is no proven demo/sample on it...
anyway, thank all again