I have a bit of an unusual problem. I use Pillow with Python 3 and I need to stop a part of it from being transparent and layering.
As you can see in image 1, the hair slightly clips the hat at the left and right of it.
Image 2 is one I edited myself, and is correct. There is no clipping on the left or the right.
All 3 of the sprites (the head, the hat, and the hair) are transparent, and are the same size.
The trouble is I could just make it cut off at a certain point, but not all my hat sprites start and end in the same place. Some may do an arc shape for example, and it would end up with no hair in the arc.
This is the code I'm using:
from PIL import Image, ImageTk, ImageChops
background = Image.open("headbase.png")
foreground = Image.open("hair2.png")
Image.alpha_composite(background, foreground).save("test3.png")
background2 = Image.open("test3.png")
foreground2 = Image.open("testhat2.png")
Image.alpha_composite(background2, foreground2).save("testo.png")
Aucun commentaire:
Enregistrer un commentaire