Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import Image
- ### SETTINGS
- ####################
- X = 800
- Y = 600
- BLOCK_SIZE = 20
- ALTERNATE_LINES = True
- COLOUR = (51, 153, 255)
- BACKGROUND = (255, 255, 204)
- ### CONSTANTS
- ####################
- size = X, Y
- im = Image.new('RGB', size, BACKGROUND)
- counter = 1
- for i in range(0, (X / BLOCK_SIZE)):
- for j in range(0, (Y / BLOCK_SIZE)):
- if (i % 2) == (counter % 2):
- for x in range((i * BLOCK_SIZE), ((i * BLOCK_SIZE) + BLOCK_SIZE)):
- for y in range((j * BLOCK_SIZE), ((j * BLOCK_SIZE) + BLOCK_SIZE)):
- im.im.putpixel((x, y), COLOUR)
- if (j % 2) == (counter % 2):
- for x in range((i * BLOCK_SIZE), ((i * BLOCK_SIZE) + BLOCK_SIZE)):
- for y in range((j * BLOCK_SIZE), ((j * BLOCK_SIZE) + BLOCK_SIZE)):
- im.im.putpixel((x, y), COLOUR)
- if ALTERNATE_LINES:
- counter += 1
- im.save('output.png')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement