如何在C#中动态地进行“图像的色彩平衡”(如photoshop)。 [英] How to do "Color balance of image"(like photoshop) in C# dynamically..

查看:101
本文介绍了如何在C#中动态地进行“图像的色彩平衡”(如photoshop)。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,



我需要更改图片中的颜色,但喜欢photoshop中的色彩平衡





我用过这段代码:





Hi All,

I need to change Colors in an image but like "color balance" in photoshop


I used this code:


Bitmap bmp = new Bitmap(this.BackgroundImage);
for (int x = 0; x < bmp.Width; x++)
{
    for (int y = 0; y < bmp.Height; y++)
    {
          bmp.SetPixel(x, y, Color.Black);
        
    }
}

this.BackgroundImage = bmp;

< br $> b $ b



但我的图片中的颜色变为黑色...



如何解决这个色彩平衡问题...



请帮忙。



谢谢提前。




but the whole colors in my image changed to black...

How can I solve this color balance problem...

Please help.

Thanks in Advance.

推荐答案

好的,现在我看到你正在使用 System.Drawing 。出于性能原因,请勿使用 SetPixe l / GetPixel !使用 System.Drawing.Bitmap.LockBits 。 MSDN帮助页面有一个代码示例:

http:/ /msdn.microsoft.com/en-us/library/system.drawing.bitmap.aspx [ ^ ]。



有不同的色彩平衡方法。您可以实施最简单的方法:手动平衡。你呈现reg,绿色和蓝色滑块;用户增加或减少每个的贡献;并为每个像素逐个修饰每个颜色组件。



-SA
OK, now I see you're using System.Drawing. For performance reasons, never use SetPixel/GetPixel! Use System.Drawing.Bitmap.LockBits. The MSDN help page has a code sample:
http://msdn.microsoft.com/en-us/library/system.drawing.bitmap.aspx[^].

There are different approaches to color balance. You can implement the simplest approach: a manual balance. You present reg, green and blue sliders; the user adds or reduces the contribution of each; and you retouch each color component one by one for each pixel.

—SA


I试过回答两次。即使我的答案提供了OP所述问题的直接解决方案,但它已被删除 - 两次 - 没有解释就没有答案。所以对于那些寻找这个问题的实际答案的人来说 - 你只是运气不好。感谢您的网站成员。
I tried answering twice. Even though my answer provided a direct solution to the problem as stated by the OP, it was deleted--twice--marked as not an answer without explanation. So to anyone looking for an actual answer to this problem--you're just out of luck. Thank your fellow site members.


这篇关于如何在C#中动态地进行“图像的色彩平衡”(如photoshop)。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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