什么是平均两种颜色定义线性渐变的最好方法? [英] What is the best way to average two colors that define a linear gradient?

查看:398
本文介绍了什么是平均两种颜色定义线性渐变的最好方法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我有两种颜色由RGB值定义,我可以平均红色,绿色和蓝色值,然后组合定义第三种颜色,看起来像两个视觉平均值?



即NewColor =(R1 + R2)/ 2,(G1 + G2)/ 2,(B1 + B2)/ 2



EDIT1:感谢所有的回应。对于我目前的需要,我只处理颜色对是相同颜色的阴影,所以我认为平均它们将工作。但是,我将尝试转换到实验室空间,以确保该假设是真实的,这项技术将在未来有用。



编辑2:这里是我的结果FWIW。 Color1和Color2是我的两种颜色,两个中间列分别是在L 的答案。



基本上,您想将颜色转换为名为实验室空间,并在该空间中找到它们的平均值。



实验室空间是一种表示颜色的方法,其中彼此接近的点是看起来类似的点彼此对人类。


If I have two colors defined by their RGB values, can I average the Red, Green and Blue values and then combine to define a third color that looks like a visual average of the two?

ie NewColor = (R1+R2)/2,(G1+G2)/2,(B1+B2)/2

EDIT1: Thanks for all the responses. For my current needs, I am only dealing with color pairs that are shades of the same color so I think that averaging them will work. However, I will try converting to Lab Space to make sure that assumption is true and the technique will be useful in the future.

EDIT2: Here are my results FWIW. Color1 and Color2 are my two colors and the two middle columns are the results of averaging in Lab space and averaging RGB respectively. In this case there is not a lot of difference between the two color and so the differences in the output from the averaging techniques is subtle.

解决方案

Take a look at the answers to this question.

Basically, you want to convert the colors into something called Lab space, and find their average in that space.

Lab space is a way of representing colours where points that are close to each other are those that look similar to each other to humans.

这篇关于什么是平均两种颜色定义线性渐变的最好方法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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