Spaces:
Configuration error
Configuration error
File size: 294 Bytes
d3fbdbe a43551d d3fbdbe |
1 2 3 4 5 6 7 8 9 10 11 |
from PIL import Image
def alpha_composite(img: Image, background: Image = None):
if not background:
background = Image.new("RGBA", img.size, (255, 255, 255))
result = Image.alpha_composite(background, img.convert("RGBA"))
result = result.convert("RGB")
return result
|