更换颜色在C#中的图像中 [英] replace color in an image in c#

查看:336
本文介绍了更换颜色在C#中的图像中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

什么是C#的方式来代替对图像的某些部分颜色,而不会影响其质感?

What is the way in C# to replace a color for some parts of an image without affecting its texture?

您可以看到结果的好例子的这里结果
谢谢

You can see good example of the result here
Thanks

推荐答案

发现这样做的方式,这需要RGB< - > HSL转换(好类HSL颜色可以发现的这里)结果
1.获取一个参考(在HSL)表示要替换结果
2.获取目标颜色结果
3.获取图像像素的HSL值和颜色值每个像素:结果
4.计算像素的HSL值,并将其替换为所有(pixelHsl / refHsl)* targetHsl

Found the way to do that, this requires RGB<->HSL conversions (good class for HSL color can be found here)
1. Get a reference value (in hsl) representing the color you want to replace
2. Get the hsl value for your target color
3. Get image pixels and for each pixel:
4. calculate the hsl value of the pixel, and replace it with (pixelHsl / refHsl) * targetHsl

这做的工作对我来说,谁感谢帮助

This did the job for me, thanks for all who helped

这篇关于更换颜色在C#中的图像中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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