[IPython-dev] default colorscheme

Walter Dörwald walter at livinglogic.de
Wed Jul 6 08:08:43 EDT 2011


On 06.07.11 10:59, David Hirschfeld wrote:

> [...]
> Christopher Barker <Chris.Barker <at> noaa.gov> writes:
>>
>> you also might want to get a bit fancier than simply scaling linearly
>> R,G, and B don't necessarily all contribute equally to our sense of
>> "whiteness"
>>
>> For instance, PIL uses:
>>
>> """
>> When from a colour image to black and white, the library uses the ITU-R
>> 601-2 luma transform:
>>
>>      L = R * 299/1000 + G * 587/1000 + B * 114/1000
>> """
>>
>> which would be easy enough to do with numpy.

Or simply use colorsys:

>>> import colorsys
>>> colorsys.rgb_to_hsv(60/255.,255/255.,60/255.)[2] >= 0.5

Servus,
   Walter




More information about the IPython-dev mailing list