the-honk/python/pythonchallenge.com/7 - Oxygen.py
2024-10-09 18:02:48 +01:00

11 lines
No EOL
308 B
Python

import re
from PIL import Image
img = Image.open('oxygen.png')
row = [img.getpixel((x, img.height / 2)) for x in range(img.width)][::7]
ords = [r for r, g, b, a in row if r == g == b]
msg = ''.join(map(chr, ords))
nums = re.findall('\d+', msg)
nextLevel = ''.join(map(chr, map(int, nums)))
print(nextLevel)