[sugar] how to make a grayscale image?
Bert Freudenberg
bert
Fri Nov 2 04:45:37 EDT 2007
On Nov 2, 2007, at 3:16 , Albert Cahalan wrote:
> Eben Eliason writes:
>
>> Roughly speaking, you can calculate a colored pixel's effective
>> luminance by:
>>
>> Y = 0.3*R+0.59*G+0.11*B
>
> To be clear on why this is rough: it performs an operation
> on non-linear data which is only valid on linear data.
> That is, it ignores gamma.
>
> From best to worst:
>
> a. convert to linear, Y = 0.3*R+0.59*G+0.11*B, convert back
> b. square, Y = 0.3*R+0.59*G+0.11*B, square root
> c. Y = 0.3*R+0.59*G+0.11*B
> d. Y = (R+G+G+B)>>2
> e. Y = G
>
> FYI, most interesting image operations are only valid on
> linear data. This includes scaling and alpha blending.
> Lots of programmers degrade images by screwing this up.
> We should all try to do better, especially when the image
> is something that might be important to the user.
Right. For example, am I the only one who is bothered by the huge
change in perceived brightness of different colors when you switch
the DCON to grayscale mode? This switch from swizzling to the per-
pixel brightness calculation gives a huge difference.
- Bert -
More information about the Sugar-devel
mailing list