[Image-SIG] Font colour

Dave LeCompte dave at leviathangames.com
Fri Apr 27 16:54:06 CEST 2007

> From: Douglas Bagnall <douglas at paradise.net.nz>
> Subject: Re: [Image-SIG] Font colour
> But I think the
> clearest way, based on watching subtitled movies, is to have the text
> in a constant colour, with an outline, or shadow, or glow.  So I would
> try instead:
> blur = mask.filter(ImageFilter.BLUR)
> im.paste((0,0,0), (0,0), blur)
> im.paste((255,255,255), (0,0), mask)
> for white writing with a black halo.  Maybe black on white is better.

That's an interesting way to accomplish this - I'm not familiar with the 
filtering approach, so I did something similar the hard way:

    ( 2,-2,(0,0,0)),
    (-2, 2,(0,0,0)),
    ( 2, 2,(0,0,0)),
    (-3, 0,(0,0,0)),
    ( 3, 0,(0,0,0)),
    ( 0,-3,(0,0,0)),
    ( 0, 3,(0,0,0)),
    ( 0, 0,(255,255,0))]

for dispOff in displayOffsets:

    lSurf=lineFont.render(line, 1, c)

I was drawing text over a photographic image for use on a projection 
screen - this approach gives a few jaggy bits that you can see close up, but 
weren't a problem in pratice for me. As you can see there, I hard coded it 
to yellow text on a black background, which was pretty readable on most 

I was fortunate that I had a little bit of choice in the images that I was 
drawing, so I could select photographic backgrounds that complemented the 
text, rather than adapting the text to fit the photos.

-Dave LeCompte 

More information about the Image-SIG mailing list