Skip to content

Instantly share code, notes, and snippets.

@luelista
Last active September 2, 2016 17:40
Show Gist options
  • Save luelista/149c1d2f7d65f3cf7a0ab6747ad8c966 to your computer and use it in GitHub Desktop.
Save luelista/149c1d2f7d65f3cf7a0ab6747ad8c966 to your computer and use it in GitHub Desktop.
def drawbars(img, width, height):
x=0
while x<width:
img.paste((255,0,0), (x,0,x+1,height))
x+=2
img.paste((255,0,0), (x,0,x+3,height))
x+=6
img.paste((0,255,0), (x,0,x+1,height))
x+=2
img.paste((0,255,0), (x,0,x+2,height))
x+=6
img.paste((0,0,255), (x,0,x+1,height))
x+=2
img.paste((0,0,255), (x,0,x+1,height))
x+=6
img=PIL.Image.new('RGB',(320,240))
drawbars(img, 320, 240)
img.save("/home/mw/Web/test1.png")
img=PIL.Image.new('RGB',(320,240))
img.paste((255,255,255), (0,120,320,240))
drawbars(img, 320, 240)
img.save("/home/mw/Web/test2.png")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment