我一直在研究如何把两张照片放在一起,把最上面的一张透明度提高到50%左右。在
到目前为止,我找到了这个:
from PIL import Image
def merge():
background = Image.open("ib.jpg")
background = background .convert('L') #only foreground color matters
foreground = Image.open("if.jpg")
background.paste(foreground, (0, 0), foreground)
background.show()
但它只输出一个空白图像。在
两种尺寸都一样。在
在日立银行公司名称:
在如果.jpg公司名称:
期望输出:
对于使用RGB或RGBA文件执行此操作有什么提示吗?我应该处理这两种类型(有些,事实上,有alpha层)。在
谢谢
必须使用
PIL.Image
中的blend
函数:相关问题 更多 >
编程相关推荐