开发者

get base64 in javascript to silverlight image

I have a javascript function that get base64 string then I need to pass this value to a silverlight object within开发者_运维百科 my page to render the base64 as jpeg image

Now I use AJAX to build the image and rerender it on the page but it take alot of time I believe that with silverlight it won't take that much of time

So any resources on this issue?


You can just set the image src to the base64 string, both on tags and in CSS. So you don't have to convert the base64 string, you can just render it in place. This will give you a faster user experience.

Replace the underscores in the following examples with your base64 string:

<img src="data:image/png;base64,______________">

Or, using CSS:

background-image: url(data:image/png;base64,_____________);

If you want to send something from JavaScript to Silverlight (1) to process it (2), and then maybe back from Silverlight to JavaScript (3), check out the below links. When I say "process it", this probably means saving the image and sending back an image URL. But if you want to display it using Silverlight, this is of course unnecessary.

  1. JavaScript/Silverlight Interop (includes passing JS parameter to Silverlight)
  2. C#: Base64 string to Bitmap
  3. Pass parameters from Silverlight to JavaScript
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜