from PIL import Image
import random
im = Image.new('P', (16,16))
im.putpalette([103,183,11,114,194,31,125,205,46,130,217,63])
for y in range(16):
    xs = list(range(16))
    random.shuffle(xs)
    for x in xs:
        if random.randrange(4) != 0: continue
        for i in range(3):
            im.putpixel((x, y), max(im.getpixel((x,y)), i+1))
            k = random.randint(-1, 3)
            if k >= 2: k = 0
            x = (x+k)%16
            k = random.randint(0, 4)
            if k >= 2: k = 1
            y = (y-k)%16
im.save("grass.png")

