Turn PDF into grayscale

Dariusz J. Garbowski thuforuk at yahoo.co.uk
Tue Jun 27 00:00:41 UTC 2006


On 06/27/2006 12:34 AM, gabrielle harrison and Paul van den Bergen wrote:
> On Tue, 27 Jun 2006 09:08:00 +1000, Dariusz J. Garbowski 
> <thuforuk at yahoo.co.uk> wrote:
>> This is simple: gray colour is made of all three RGB channels having 
>> the same value. Thus you have:
>>
>>    R   G   B  shade of gray
>>    0   0   0  black
>>    1   1   1  almost black
>>    2   2   2  almost black
>> ...
>> 127 127 127  gray
>> 128 128 128  a bit lighter gray
>> ...
>> 255 255 255  white
>>
>> what makes 256 colour space (or "gray space" ;-) This can only improve 
>> if you have more bits-per-channel. Notice that 24 bit colour jpg is 
>> only 8 bit per channel (3 channels * 8 bit = 24 bit).
> 
> So how is the gray scale value calculated?  is it just the average of 
> the RGB values?
> 
> e.g. would
> 
>     R   G   B
>     126 0   0
> and
>     R   G   B
>     0   126 0
> and
>     R   G   B
>     0   0   126
> 
> all convert to the same gray scale of
> 
>     R   G   B
>     42  42  42
> 
> ???

It's not that simple. One of the most widely used formulas is (comes 
from physical characteristics of CRT television):

Y = 0.299*R + 0.587*G + 0.114*B

which means that green channel contributes most brightness, followed by 
red, then blue. (Note: this is also the reason why digital cameras' 
sensors typically have 50% of green pixels, 25% red and 25% blue -- see 
http://en.wikipedia.org/wiki/Bayer_filter).

Some more details on RGB -> gray conversion can found at e.g. Color FAQ:
http://www.poynton.com/notes/colour_and_gamma/ColorFAQ.html#RTFToC9

Hope this helps,
Dariusz






		
___________________________________________________________ 
Try the all-new Yahoo! Mail. "The New Version is radically easier to use" – The Wall Street Journal 
http://uk.docs.yahoo.com/nowyoucan.html





More information about the kubuntu-users mailing list