"ValueError: bad transparency mask" when pasting one image onto another with Python Imaging Library? "ValueError: bad transparency mask" when pasting one image onto another with Python Imaging Library? python python

"ValueError: bad transparency mask" when pasting one image onto another with Python Imaging Library?


Late to the game here, but I just ran into the same issue. After some googling I was able to get my mask to work by making sure all of the images being used were the same mode (specifically "RGBA").

You might try this:

card = Image.new("RGBA", (220, 220), (255, 255, 255))img = Image.open("/Users/paulvorobyev/test.png").convert("RGBA")x, y = img.sizecard.paste(img, (0, 0, x, y), img)card.save("test.png", format="png")