从图像控件将图像保存到特定路径 [英] Save Image to particular path from Image Control

查看:74
本文介绍了从图像控件将图像保存到特定路径的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

亲爱的朋友,

我想将图像保存到Image Control的特定路径.示例代码如下.

XMLA代码
----------

Dear Freinds,

I want to save Image to particular path from Image Control. Sample coding are below.

XMLA Code
----------

<Image Source="{Binding signat}" Canvas.Left="6" Canvas.Top="74" Height="423"                x:Name="img_signature" Stretch="Fill" Width="573">
</Image>


CS代码
-------


Cs code
-------

Binding b = new Binding();
b.Source = ds.Tables["tab_grdbindload"];
b.UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged;
b.Path = new PropertyPath("signat");
this.img_signature.SetBinding(Image.SourceProperty, b);


上面的编码用于从数据库加载图像.
现在,我想在特定路径中保存加载的图像.

预先感谢,
Maha S.


The above coding used to loaded image from database.
Now I want to save loaded image in particular path.

Thanks in advance,
Maha S.

推荐答案

我的解决方案在这里工作正常..

my solution is here its working fine..

var encoder = new PngBitmapEncoder();                 encoder.Frames.Add(BitmapFrame.Create((BitmapSource)img_signature.Source));
using (FileStream stream = new FileStream(strpath + strfilename, FileMode.Create))
encoder.Save(stream);


这篇关于从图像控件将图像保存到特定路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆