python - Cutting image after a certain point -


i have bit of unusual problem. use pillow python 3 , need stop part of being transparent , layering.

as can see in image 1, hair clips hat @ left , right of it.

image 2 1 edited myself, , correct. there no clipping on left or right.

all 3 of sprites (the head, hat, , hair) transparent, , same size.

the trouble make cut off @ point, not hat sprites start , end in same place. may arc shape example, , end no hair in arc.

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

this simple problem. need here make transparency mask (make areas coloured don't want have hair) areas don't want covered hair.

then, need this:

    image.composite(hat, faceandhair, mask).save("result.png") 

then can tinting code want.


Comments

Popular posts from this blog

Payment information shows nothing in one page checkout page magento -

tcpdump - How to check if server received packet (acknowledged) -