Christopher , Thank you for your reply. Is there a way how to find out a complementary colour for an area where I will write the text, so that the text will be seen clearly?Is there a routine in PIL or in Python somewhere? Thank you for help Lad. >
> [EMAIL PROTECTED] wrote: > > > Is there a way how to set the font colour so that it will be seen very > > clearly in the picture? > > One way to do this in general is to put a background color behind the > font. I don't see a way to do this automatically with PIL, but you can > get the size of the text: > > font.getsize(text) => (width, height) > > Then draw a rectangle of that size before you draws the text. If you > (for example) draw a white rectangle, then black text, you will be able > to see that on top of any color. > > The option is to get fancy with determining the average color of th > region where the text goes, then create a color that contrasts with > that. However, if your text overlaps two (or more) regions of very > different colors, it may be hard to automatically get a color that > contrasts with all of them. > > -Chris > > > -- > Christopher Barker, Ph.D. > Oceanographer > > Emergency Response Division > NOAA/NOS/OR&R (206) 526-6959 voice > 7600 Sand Point Way NE (206) 526-6329 fax > Seattle, WA 98115 (206) 526-6317 main reception > > [EMAIL PROTECTED] _______________________________________________ Image-SIG maillist - Image-SIG@python.org http://mail.python.org/mailman/listinfo/image-sig