How to find complementary colour for pixel

James Stroud jstroud at mbi.ucla.edu
Fri Apr 27 00:17:42 EDT 2007


Johny wrote:
>  I use PIL to write some text to a picture.The text must  be seen wery
> clearly.
> I write the text to different pictures but to the same position. As 
> pictures maybe  different, colour, in the position where I write the
> text, is also different.
> Is there a way how to set the font colour so that it will be seen very
> clearly in the picture?
> For example, if the picture is bright ( for example yellow), the font
> colour should be dark( e.g. black) and vice versa.
> Is there a routine in PIL available  that calculates complementary
> colour for RGB pixel format?
> Can anyone help?
> Thanks
> L.
> 

Don't you just xor with black?



More information about the Python-list mailing list