Skip to content

Instantly share code, notes, and snippets.

@kung-foo
Last active August 29, 2015 14:26
Show Gist options
  • Save kung-foo/5022ec1ed6237bf33b66 to your computer and use it in GitHub Desktop.
Save kung-foo/5022ec1ed6237bf33b66 to your computer and use it in GitHub Desktop.
import Image, ImageDraw
from random import randint
def draw_picture(output_filename):
print('drawing: {}'.format(output_filename))
image = Image.new('RGB', (640, 480), 'black')
draw = ImageDraw.Draw(image)
for i in xrange(0, 640, 20):
for j in xrange(0, 480, 20):
draw.ellipse(
(i + 1, j + 1, i + 19, j + 19),
fill='hsl({}, 100%, 50%)'.format(randint(0, 256)),
outline='white')
image.save(output_filename)
for img_id in xrange(30):
draw_picture('circles-{}.png'.format(img_id))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment