【发布时间】:2019-04-01 17:07:47
【问题描述】:
尝试使用 pyvips 2.1.5 合成图像时:
import pyvips
i1 = pyvips.Image.black(100, 100, bands=4) + (255, 0, 0, 128)
i2 = pyvips.Image.black(10, 10, bands=4) + (0, 255, 0, 128)
i1.composite(i2, 'over').write_to_file('output.png')
它输出大小为 10x10px 的绿色正方形,而不是预期的 100x100px alpha 混合正方形。
同时合成多个图像文件 (pyvips.Image.new_from_file) 似乎可以正常工作,但是使用上面生成的图像之一这样做会失败,原因是:
pyvips.error.Error: unable to call composite
composite: images do not have same numbers of bands
即使所有图像的bands 返回4。
我用错了吗? 感谢您的帮助!
【问题讨论】: