如何在 wand (python) 中并排堆叠两个图像?复合方法是可用的,但它将一个图像放在另一图像之上。 我想要像 numpy.vstack 这样的东西。
最佳答案
您还可以使用 smush()
并在图像之间设置可选间距,并且:
stacked=True
用于垂直(一个在另一个之上)堆叠,或stacked=False
用于并排堆叠。
from wand.image import Image
im = Image(filename="rose:")
with im as output:
output.sequence.append(im)
output.sequence.append(im)
output.smush(True, 5)
output.save(filename='result.png')
如果您不希望图像之间有任何间距,请设置 offset=0
或仅使用 concat()
而不是 smush()
但以完全相同的方式。
关于python - 使用 Wand 并排堆叠两个图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45203059/