开发者

save writableimage to file in silverlight

开发者 https://www.devze.com 2023-03-03 23:24 出处:网络
How want to save the image of a canvas to a file. var img = new WriteableBitmap(canvas1, null); Image i = new Image();

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.

0

精彩评论

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