两张图像做简单直接的融合(blend)
程序员文章站
2022-03-20 13:16:46
...
from PIL import Image
def blend_images(floder, img1_name, img2_name, alpha=0.5):
img1 = img1_name # './img1.png'
img1 = Image.open(img1)
img1 = img1.convert('RGBA')
img2 = img2_name # './img2.png'
img2 = Image.open(img2)
img2 = img2.convert('RGBA')
img = Image.blend(img1, img2, alpha)
img.save('out.png')
推荐阅读