File size: 245 Bytes
047d71d
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
from PIL import Image


class AlphaComposite:
    def __call__(self, im_rgb, bg_img):
        bg_img = bg_img.convert("RGBA")
        im_rgb = im_rgb.convert("RGBA")
        result = Image.alpha_composite(bg_img, im_rgb)
        return result