简体   繁体   中英

How do I put python images together using PIL?

I am trying to put these cropped sections of PNG images together into one Image file but I am getting and error. Here is my code:

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()

And here is the error:

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

How can I put all three panels into one image using PIL?

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

Looks like you're missing some commas.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM