修改图像中像素颜色的代码. [英] code that modify pixel color in an image.

查看:108
本文介绍了修改图像中像素颜色的代码.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

帮助我编写代码来修改图像中的像素颜色.

help me to write a code that modify pixel color in an image.

推荐答案



您应该看看Christian Graus的有关C#中位图操作的系列文章.这显示了您需要了解的所有内容:
使用C#和GDI +的傻瓜图像处理-第1部分-每个像素过滤器 [
Hi,

you should have a look at Christian Graus'' series of articles about bitmap manipulation in C#. This shows everything that you need to know:
Image Processing for Dummies with C# and GDI+ Part 1 - Per Pixel Filters[^]

or for a very simple way to set a pixel in a pictureBox:
Bitmap bmp = (Bitmap)pictureBox1.Image;
bmp.SetPixel(5, 5, Color.White);
pictureBox1.Image = (Image)bmp;


请注意,GetPixelSetPixel非常慢.您应该看一下Christian的文章,看看他是如何使用不安全的代码解决此问题的.


Please note that GetPixel and SetPixel is very slow. You should have a look at Christian''s article and see how he solves this issue using unsafe code.


JF2015的答案是正确的,只需购买System.Drawing即可. >
正如我所指出的,GetPixel/SetPixel对于任何人来说都太慢了
快速操作需要锁定位技术和元帅,请参见
http://msdn.microsoft.com/en-us /library/5ey6h79d.aspx [ ^ ].

对于WPF,快速操作要容易得多.请参见类System.Windows.Media.Imaging.BitmapSource及其派生类.

—SA
The answer by JF2015 is correct, buy only about System.Drawing.

As I pointed out, GetPixel/SetPixel is too slow for any
The fast operation requires lock bit technique and Marshal, see http://msdn.microsoft.com/en-us/library/5ey6h79d.aspx[^].

For WPF, fast operations are much easier; see the class System.Windows.Media.Imaging.BitmapSource and its derived classes.

—SA


这篇关于修改图像中像素颜色的代码.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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