from PIL import Image

im = Image.open('WFC.png')
pix = im.load()

#left,top,right,bottom
pos = [[[0,10],[0,50],[0,90]],[[10,0],[50,0],[90,0]],[[99,10],[99,50],[99,90]],[[10,99],[50,99],[90,99]]]

for y in range(4):
    for x in range(4):
        text = "tiles.push(new tile(";
        for l in range(4):
            text += "["
            for p in range(3):
                startX = x*100
                startY = y*100
                hex = '#%02x%02x%02x' % pix[startX + pos[l][p][0],startY + pos[l][p][1]]
                text += "'" + hex + "'"
                if p != 2:
                    text += ","
            text += "]"
            if l != 3:
                text += ","
        text += "));"
        print (text)