PIL and font colours.

Diez B. Roggisch deets at nospam.web.de
Tue Apr 24 21:48:19 CEST 2007


Johny schrieb:
>  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.
> Can anyone help?

Please don't post the same message three times. Once is enough.

For your problem are different solutions - you could compute an average 
over the occupied background, convert the result to HSV and select a H 
at the opposite, and also modify S and V.

Diez



More information about the Python-list mailing list