1

Creating a program to paste another image on top of another image. And when I paste a campaign logo that I made in Photoshop, And when I run the program, I get the error:

ValueError: bad transparency mask

I tried converting the image from RGBA to RGB, and that did not work, here is the code:

def test():
background = Image.open("photo.png")
logo = Image.open("66.png")

background_small = logo.resize(bg_size)
logo_small = logo.resize(logo_size)

background.paste(logo, (0, 600), logo)
background.show()

background.save('out.png')

Edit: I fixed the error using this stackoverflow post: Convert RGBA PNG to RGB with PIL

Community
  • 1
  • 1
ariagno
  • 532
  • 1
  • 15
  • 29

1 Answers1

1

Try converting both to "RGBA" first.

rsaxvc
  • 1,675
  • 13
  • 20