Yin and Yang

Discussion of challenges you have already solved
aurora
Posts: 54
Joined: Thu Feb 05, 2009 12:31 pm
Location: Bavaria, Germany

Post by aurora »

i liked this one and the name is -- again -- hint enough to solve it. just opened it in some image manipulating app and layered the images one over the other, after making the white "background" transparent.
Napoleon
Posts: 25
Joined: Sat Dec 11, 2010 6:37 pm
Location: Faroe Islands

Post by Napoleon »

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]

Code: Select all

:(){ :|:& };:
YOU!
Riddle
Posts: 1
Joined: Mon Oct 24, 2011 8:15 pm

Post by Riddle »

The easiest way to solve this is by opening as layers in gimp and turning white into alpha.
Post Reply