码迷,mamicode.com
首页 > Windows程序 > 详细

WPF_图片黑白处理

时间:2015-08-05 21:41:44      阅读:611      评论:0      收藏:0      [点我收藏+]

标签:

技术分享
 1    BitmapImage myBitmapImage = new BitmapImage ( );
 2             myBitmapImage . BeginInit ( );
 3             myBitmapImage . UriSource = new Uri ( ImagePath , UriKind . Relative );
 4             myBitmapImage . DecodePixelWidth = 200;
 5             myBitmapImage . EndInit ( );
 6             FormatConvertedBitmap newFormatedBitmapSource = new FormatConvertedBitmap ( );
 7             newFormatedBitmapSource . BeginInit ( );
 8             newFormatedBitmapSource . Source = myBitmapImage;
 9             newFormatedBitmapSource . DestinationFormat = PixelFormats . Gray32Float;
10             newFormatedBitmapSource . EndInit ( );
11             Image myImage = new Image ( );
12             myImage . Width = 200;
13             //set image source
14             myImage . Source = newFormatedBitmapSource;
View Code

 

WPF_图片黑白处理

标签:

原文地址:http://www.cnblogs.com/linbinqiang/p/4705695.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!