Hi Mike,

I think this might depend on what your app does. The simple answer would be to 
convert each of the hex couplets for R, G, and B to decimal, take the average 
of the three, round it, and then convert this average back to a hex couplet. 
The R, G, and B for the shade of grey will all be the hex version of the 
average. Percentage-wise, exactly the same - just divide the decimal average by 
2.55.

The implication of the RGB colour scale is that luminance is directly 
proportional to the average of the R, G and B couplets. If you view a block of 
the resultant grayscale beside a block of the original colour, I very much 
doubt you'll consider them equal in terms of luminous intensity. 

Regards,
Simon

-----Original Message-----
From: Discussion of advanced .NET topics. [mailto:[EMAIL PROTECTED] On Behalf 
Of Mike Andrews
Sent: 27 October 2006 14:17
To: ADVANCED-DOTNET@DISCUSS.DEVELOP.COM
Subject: [ADVANCED-DOTNET] Algorithm question...

Guys,

Does anyone know how to convert an RGB value into either a grayscale
percentage or an RGB gray value?

Thanks,
Mike

===================================
This list is hosted by DevelopMentorR  http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com
===================================
This list is hosted by DevelopMentorĀ®  http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com

Reply via email to