Posted by lorento on 07/04/06 11:18
Found some code:
$grey= 0.2125*$rgb['red']+ 0.7154*$rgb['green']+ 0.0721*$rgb['blue'];
--
http://blog.deshot.com
http://www.immersivelounge.com
julian_m wrote:
> Do anyone know an algorithm which retieves a grey value given certain
> rgb value?
>
> I'm needing this kind of function:
>
> $grey = RGBtoGrey('#ffffff');
>
> where $grey (function's return value) should be a real number in [0;1]
> range
>
> Googling a little bit, I found an equation which seems to be aplied by
> many photo-editor software
>
> (.3*Red) + (.59*Green) + (.11*Blue)= Luminance/brightness
>
> I'm just wondering whether someone here has better ideas...
>
> regards - julian
[Back to original message]
|