Troll_Hunter
Troll_Hunter

Reputation: 515

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?

Upvotes: 1

Views: 370

Answers (1)

Kevin
Kevin

Reputation: 76194

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

Upvotes: 1

Related Questions