from PIL import Image
k1=636806841748368750477720528895492611039728818913495104112781919263174040060359776171712496606031373211949881779178924464798852002228370294736546700438210687486178492208471812570216381077341015321904079977773352308159585335376746026882907466893864815887274158732965185737372992697108862362061582646638841733361046086053127284900532658885220569350253383469047741742686730128763680253048883638446528421760929131783980278391556912893405214464624884824555647881352300550360161429758833657243131238478311219915449171358359616665570429230738621272988581871
# Assign k1,k2, k3 to k to get desired image
k = k1
width = 106
height = 17
scale = 5
fname = "foo"
image = Image.new("RGB", (width, height),(255, 255, 255))
for x in range (width):
for y in range (height):
if ((k+y)//17//2**(17*int(x)+int(y)%17))%2 > 0.5:
# Image need to be flipped vertically - therefore y = height-y-1
image.putpixel((x, height-y-1), (0,0,0))
#scale up image
image = image.resize((width*scale,height*scale))
image.save(fname+".png")