[Image-SIG] Does RGBA drawing mode work?

Uttam M. Narsu unarsu at gmail.com
Wed Dec 10 19:13:27 CET 2008


I'm trying to draw using the experimental **RGBA-on-RGB interface. I can't
seem to get it to work.

from PIL import Image, ImageDraw

ml = Image.new("RGBA", (200,200))
D = ImageDraw.Draw(ml, "RGBA")

red = (0xff, 0x00, 0x00, 0xA9)
green = (0x00, 0xbf, 0x00, 0x83)

D.polygon([(40, 40), (40, 100), (100, 100), (100, 40)], fill=red)
D.polygon([(20, 20), (20, 80), (80, 80), (80, 20)], fill=green)
ml.save("test.png", "PNG")

Results in the attached image. The red polygon doesn't show through beneath
the green one.

I'd appreciate any pointers on this. It seems fairly simple.

-
uman
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/image-sig/attachments/20081210/adacbfc1/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test.png
Type: image/png
Size: 2785 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/image-sig/attachments/20081210/adacbfc1/attachment.png>


More information about the Image-SIG mailing list