With the Python Imaging Library (PIL), how does one compose an image with an alpha channel over another image?

后端 未结 3 573
执笔经年
执笔经年 2020-11-28 06:20

I have two images, both with alpha channels. I want to put one image over the other, resulting in a new image with an alpha channel, just as would occur if they were render

3条回答
  •  南方客
    南方客 (楼主)
    2020-11-28 06:45

    Pillow 2.0 now contains an alpha_composite function that does this.

    img3 = Image.alpha_composite(img1, img2)
    

提交回复
热议问题