如何在wpf的图像控制上保存图片? [英] How can I save the picture on image control in wpf?
本文介绍了如何在wpf的图像控制上保存图片?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个简单的wpf应用程式 WIA 。应用程序有一个图像控制...
我想知道如何保存扫描的图片在我的硬盘上。
I have 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?
推荐答案
p>取决于 Image.Source
的类型,假设你有一个 BitmapSource
沿着这些线:
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);
这篇关于如何在wpf的图像控制上保存图片?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文