Python 3.x Python 3-如何使用PIL合成两张图片?

Python 3.x Python 3-如何使用PIL合成两张图片?,python-3.x,pillow,Python 3.x,Pillow,我正在尝试使用遗传算法生成一张由三角形图片组成的图片。我使用Image.blend()函数,但结果太暗,看起来很糟糕。我该如何处理它 image_config = { 'mode': 'RGBA', 'size': sourceimg.size, 'color': 'black' } im = Image.new(**image_config) for res in self.decode(chrom): im_tmp = Image.new(**image_config)

我正在尝试使用遗传算法生成一张由三角形图片组成的图片。我使用Image.blend()函数,但结果太暗,看起来很糟糕。我该如何处理它

image_config = {
'mode': 'RGBA',
'size': sourceimg.size,
'color': 'black'
}




im = Image.new(**image_config)
for res in self.decode(chrom):
    im_tmp = Image.new(**image_config)
    draw = ImageDraw.Draw(im_tmp, 'RGBA')
    draw.polygon(xy=[res[0], res[1], res[2]], fill=res[3])
    im = Image.blend(im, im_tmp, 0.5)

您需要或。

您需要或。

检查并确保两个图像的大小和RGBA模式相同。@JeruLuke不再显示此页面works@MatiasAndina谢谢你让我知道。检查并确保两幅图像的大小和RGBA模式相同。@JeruLuke不再显示此页面works@MatiasAndina谢谢你让我知道。