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

Douglas Bagnall douglas at paradise.net.nz
Wed Apr 11 01:48:53 CEST 2007


Alexey Borzenkov wrote:

> The problem you have happens because alpha channel of images *also*
> gets composited using the mask you specified. To do it right you
> actually need to split image, save target image alpha channel and
> after compositing merge it back using original alpha channel:

Alexey,  I think you are completely right about the problem, but the
solution can be quite a bit simpler:

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

dtop.paste(frame.convert('RGB'), (0,0), frame)
dtop.save("test.png")


I would say that this alpha-merging quirk comes close to being a bug --
it's probably not what most people expect.

douglas



More information about the Image-SIG mailing list