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


i'm trying paste image onto backgorund python imaging library this:

card = image.new("rgb", (220, 220), (255, 255, 255)) img = image.open("/users/paulvorobyev/test.png")  ...  x, y = img.size card.paste(img, (0, 0, x, y), img)  card.save("test.png") 

when run code, get:

 "valueerror: bad transparency mask" 

what did wrong?

late game here, ran same issue. after googling able mask work making sure of images being used 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.size card.paste(img, (0, 0, x, y), img) card.save("test.png", format="png") 

Comments

Popular posts from this blog

android - Pass an Serializable object in AIDL -

How to provide Authorization & Authentication using Asp.net, C#? -

How to use Authorization & Authentication in Asp.net, C#? -