C# 如何将位图转换为图像
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/9367292/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to convert Bitmap to Image
提问by Saeid Yazdani
I am making a median filter, the problem is manipulating pixes are only possible in Bitmap. Later I want to show the result in a PictureBoxwhich uses Image. I can't figure out a way to to solve this...Only thing I can think of is using a Streambut no idea how. Help will be appriciated~
我正在制作一个中值滤波器,问题是操作像素只能在Bitmap. 后来我想在PictureBox使用Image. 我想不出解决这个问题的方法......我唯一能想到的是使用 aStream但不知道如何。帮助将被appriciated~
private void toolStripPerformMedian_Click(object sender, EventArgs e)
{
var filtered = Filters.MedianFilter(new Bitmap(_activeImageFile), 3);
var n = Image.FromStream() //How to do this?
}
采纳答案by vcsjones
回答by Sargis Tovmasyan
Check up the namespaces.
System.Drawing.Imagecompatible with bitmap, System.Window.Control.Image- not!
检查命名空间。
System.Drawing.Image兼容位图,System.Window.Control.Image- 不!
回答by Illia.K
var codeBitmap = new Bitmap(your_info);
Image image = (Image)codeBitmap;

