
# subtract.py

from PIL import Image, ImageChops
 
triIm = Image.open("triangle.png").convert("RGB")
w, h = triIm.size

smallIm = triIm.resize((w//2, h//2)).\
                transpose(Image.FLIP_TOP_BOTTOM)
sw, sh = smallIm.size

innerIm  = Image.new("RGB", triIm.size)
innerIm.paste(smallIm, (w//2-sw//2, 2*h//3-sh//3))

sier1 = ImageChops.subtract(triIm, innerIm) 
sier1.show()
