This was pretty easy. The hardest thing was realising I needed the PIL image library and then installing it. Thank you to Samson for the link to the PIL download page. Once up and running it was pretty easy to pick the grey squares and decode their RGB value to a letter…
The code was the same for both this time since I opted to open the page directly and not use print.
Python 2.7 and 3.2.3 code
#smarty?
from PIL import Image
import re, webbrowser
im = Image.open("oxygen.png")
#get height and width
xy = im.size
height = xy[1]
width = xy[0]
#grey lines appear to go down the middle, assume that the value corresponds to a letter and boxes are 7 square
count = 3
message = ""
while count < width-21:
pix = im.getpixel((count,45))
count += 7
message += chr(pix[0])
regex = r'((?<=\[).*(?=\]))'
numbers = re.findall(regex, message)
letters = numbers[0].split(", ")
final = ""
for letter in letters:
final += chr(int(letter))
webbrowser.open("http://www.pythonchallenge.com/pc/def/" + final + ".html",new=2)