Last active
December 30, 2016 23:52
-
-
Save ramdyne/7b9cb00c60fb626773f6045f00d52d1b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from PIL import Image | |
from random import randint | |
default_image_name = "tile_default.png" | |
attention_image_name = "tile_attention.png" | |
output_image_name = "tile_output.png" | |
tile_size_pixels = 64 | |
new_image = Image.new("RGB", (1024, 1024)) | |
default_tile = Image.open(default_image_name) | |
attention_tile = Image.open(attention_image_name) | |
for row in range(0,16) : | |
for column in range(0,16) : | |
dice = randint(0,15) | |
if dice >=14 : | |
paste_image = attention_tile | |
else : | |
paste_image = default_tile | |
new_image.paste(paste_image, (row*64, column*64)) | |
new_image.save(output_image_name) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
So I had to create an image of 1024x1024 pixels , consisting of loads of 64x64 pixel tiles. The tiles had to be randomly chosen from 2 tiles (default and attention in the code) with a preference for the default image.