[Image-SIG] Help with PIL, Imagemagick Composite function in PIL?

César Pérez kzn.kpolice at gmail.com
Tue Apr 10 08:34:11 CEST 2007

I am new to this list but and i have a small problem with PIL. 

I am looking for a function that works like composite does in
imagemagick. If you don't know, composite puts the first image above the
second one and it's like pasting.

I have tried PIL paste but I can't get it to work as I want, specially
if my images have alpha channels. 

For example I have an example script:
from PIL import Image

dtop = Image.open("dtop.png")
frame = Image.open("frame.png")

I tried every form of paste but I always get this result or worst.

Using the images from [1] the output image is different, I uploaded the
output file created by IM and PIL to [1] and as you can see it's not the
same. Imagemagick output is im.png and PIL is pil.png. 

You can clearly see the difference if you put the images against a
background color other than white or by opening in something like GIMP
or any viewer that shows a checker pattern to represent the

Imagemagick does it as I want but PIL doesn't.

I hope somebody can help or knows how to do it because I prefer using
only PIL as it's the only thing that I don't know how to do without

1. http://www.capc-online.net/images/temp/


César Pérez

More information about the Image-SIG mailing list