Advertisement

How do you gray scale?

Started by August 22, 2002 03:11 AM
1 comment, last by ManaStone 22 years, 5 months ago
If you just average out the three color values and make them all that color, will that that work?
-----------------------------Download my real time 3D RPG.
Hi!

This should do the trick
shade = (c.red + c.green + c.blue) / 3
c.red = shade
c.green = shade
c.blue = shade
Advertisement
quote: Original post by AxoDosS
shade = (c.red + c.green + c.blue) / 3


The formula is alright, but it''s not the one usually used.
You need to take into account the luminosity of each component, i.e. green is much more "light" than red, and blue is very dark.
here is some formulas from a googlesearch :

Grey Mode Red Green Blue
luma .299 .587 .114
Luminance .212671 .715160 .072169
average .333333 .333333 .333333

luma and luminance are two different models to reflect what I just said above (luminance is the model on TV, apparently)
average is the formula that AxoDosS gave.

so if you chose the luma model your formula would be :
l = R*.299 + G*.587 + B*.114

simple


Sancte Isidore ora pro nobis !
-----------------------------Sancte Isidore ora pro nobis !

This topic is closed to new replies.

Advertisement