save writableimage to file in silverlight
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 Writeab开发者_运维技巧leBitmap to a file?
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.
精彩评论