-
Notifications
You must be signed in to change notification settings - Fork 0
/
MakeBG.py
45 lines (36 loc) · 1.15 KB
/
MakeBG.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#Imports
from PIL import Image
from random import randint
def main(tilesize, imsize):
dots = []
#Generate randomized tile image
for i in range(tilesize*tilesize):
if randint(0,1):
dots.append(
(randint(0,127), randint(0,127), randint(0,127))
)
else:
dots.append(
(randint(127,255), randint(127,255), randint(127,255))
)
##for i in range(50):
## dots.append((i%2*255, 0, 0))
tile = Image.new('RGB', (tilesize,tilesize))
tile.putdata(dots)
#Tile image on new image
img = Image.new('RGB', imsize)
for x in range(0, imsize[0], tilesize):
for y in range(0, imsize[1], tilesize):
## print(left, top)
img.paste(tile, (x, y))
#Create focusing squares
dot = Image.new('RGB', (10,10))
dot.putdata([(255,0,0)] * 100)
for x in range(20, imsize[0], tilesize):
img.paste(dot, (x, 10))
img.paste(dot, (x, imsize[1]-20))
#Save base image
img.save('BaseAuto.png')
tile.save('BaseAuto.tile.png')
if __name__ == "__main__":
main(50, (600,400))