透明度混合

1 from PIL import Image
2 img1 = Image.open(r'C:\Users\87823\Desktop\beijing.png').convert(mode = 'RGB')
3 img2 = Image.new("RGB",img1.size,'red')
4 # img2.show()
5 #Image.blend(img1,img2,alpha=0).show() # 显示第一张图片
6 #Image.blend(img1,img2,alpha=1).show() # 显示第二张图片
7 Image.blend(img1,img2,alpha=0.5).show()

猜你喜欢

转载自www.cnblogs.com/monsterhy123/p/12909869.html