开发者

How can I save the picture on image control in wpf?

开发者 https://www.devze.com 2023-03-04 06:59 出处:网络
I ha开发者_如何学JAVAve a simple wpf application WIA.My app has an image control... I was wondering how can I save the scanned pictureon my hard disk?Depends on the type of the Image.Source, assuming

I ha开发者_如何学JAVAve a simple wpf application WIA.My app has an image control... I was wondering how can I save the scanned picture on my hard disk?


Depends on the type of the Image.Source, assuming that you have a BitmapSource as in the article it should be along those lines:

var encoder = new PngBitmapEncoder();
encoder.Frames.Add(BitmapFrame.Create((BitmapSource)image.Source));
using (FileStream stream = new FileStream(filePath, FileMode.Create))
    encoder.Save(stream);


If it's a System.Drawing.Image object then just call Save?

0

精彩评论

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

关注公众号