[Image-SIG] Bad antialias? (in Python Imaging Library 1.1.5)

Fredrik Lundh fredrik at pythonware.com
Wed Sep 21 12:43:22 CEST 2005


Laszlo Zsolt Nagy wrote:

>I create a fully transparent red image this way:
>
> size = (400,400)
> img = Image.new('RGBA',size,(255,0,0,0))
>
> Then I draw an (antialiased) text on it:
>
> drawer = ImageDraw.Draw(img)
> font = ImageFont.truetype('arc.ttf',12)
> drawer.text((0,0),"This text is 12pt",font=font,fill=(0,0,0,255))
>
> This is what I get (image drawn on a gray background):
>
> http://mess.hu/download/bad_antialias.png
>
> Apparently, antialiasing will use a mixture of the background color and
> the text color on the edges.

the blending code seems to treat RGBA as yet another color layer.  I'll
look into this (and your patches) when I find the time.

> I think this is good only if the background is fully opaque. Is there a
> workaround?

a brute-force workaround is to draw into the alpha layer instead...

cheers /F 





More information about the Image-SIG mailing list