[Bluej-discuss] exercise 11.37 page 331

Michael Kölling M.Kolling at kent.ac.uk
Mon May 8 16:17:20 BST 2006


On 8 May 2006, at 16:12, Luis Moreira wrote:

> Hi Guys,
> on exercise 11.37, I manage to add the filter no problem, but the
> functionality I could not work out.
> the exercise states that to make a pixel any shade of gray we give  
> the same
> value to red,green and blue. that is fine but what value do I need  
> to give
> the three components?

You can preserve the brightness (roughly) by leaving the sum of the R/ 
G/B channels the same.

That is, compute the average of the R, G and B values, and use that  
average for all three channels.

Regards,

Michael



More information about the bluej-discuss mailing list