小编Dan*_*ela的帖子

Python PIL:将透明图像混合到另一个上

我需要使用Pythons PIL Library将图像混合到另一个图像上.

如下图所示,我的两个源图像是A和B.当我这样做时:

imageA.paste(imageB, (0, 0), imageB)
Run Code Online (Sandbox Code Playgroud)

我得到了C作为结果,但灰色背景顶部的部分现在是透明的.图像D是我在Photoshop中将B放在A上时得到的,是我需要用PIL实现的.

我究竟做错了什么?如何在PIL中用A组合B来获得D而不是C?

示例图像

python image python-imaging-library

7
推荐指数
1
解决办法
2288
查看次数

标签 统计

image ×1

python ×1

python-imaging-library ×1