如何使用 PIL 将 python 张图片放在一起?

How do I put python images together using PIL?

我试图将这些裁剪的 PNG 图像部分放在一个图像文件中,但出现错误。这是我的代码:

panel_one = img_one.crop((0, 0, w, 255))

panel_two = img_two.crop((0, 325, w, 577))

panel_three = img_three.crop((0, 645, w, h))

panel_one.paste(panel_two(0, 255))
panel_one.paste(panel_three(0, 507))
panel_one.show()

这里是错误:

Traceback (most recent call last):
  File "LArSoftDataCompiler.py", line 6, in <module>
    class PI0_Electron_Mixed_2000:
  File "LArSoftDataCompiler.py", line 20, in PI0_Electron_Mixed_2000
    panel_one.paste(panel_two(0, 255))
TypeError: '_ImageCrop' object is not callable

如何使用 PIL 将所有三个面板放入一个图像中?

panel_one.paste(panel_two(0, 255))
panel_one.paste(panel_three(0, 507))

您似乎漏掉了一些逗号。

panel_one.paste(panel_two, (0, 255))
panel_one.paste(panel_three, (0, 507))