save writableimage to file in silverlight

安稳与你 提交于 2019-12-24 02:04:28

问题


How want to save the image of a canvas to a file.

var img = new WriteableBitmap(canvas1, null);
Image i = new Image();
i.Source = img;
var bitmap = new Bitmap(i);

I tried to use bitmap.Save( for saving the image but Bitmap is not supported by silverlight. How would you save WriteableBitmap to a file?


回答1:


The WriteableBitmap has a Pixels collection which can be used to access the rendered image. However you really need to get it stored in a known format (preferable PNG).

The imagetools codeplex project can do that for you.

See this blog for a simple example of using it for your purposes.



来源:https://stackoverflow.com/questions/5949545/save-writableimage-to-file-in-silverlight

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!