-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPatternCreator.py
More file actions
27 lines (23 loc) · 1022 Bytes
/
PatternCreator.py
File metadata and controls
27 lines (23 loc) · 1022 Bytes
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
from PIL import Image
from random import randint
img = Image.new( 'RGB', (1080,1080), "white") # create a new black image
pixels = img.load() # create the pixel map
for i in range(0, img.size[0], 30):
for j in range(0, img.size[1], 30):
orientation = randint(0,3)
for k in range(0,30) :
for l in range(0,30) :
if orientation == 0 :
if ((i+k)%30 <= (l+j)%30) :
pixels[i + k, l + j] = ((i + k)/4,255,(l + j)/4)
if orientation == 1 :
if ((i+k)%30 >= (l+j)%30) :
pixels[i + k, l + j] = ((i + k)/4,255,(l + j)/4)
if orientation == 2:
if ((k + l) > 30):
pixels[i + k, l + j] = ((i + k) / 4, 255, (l + j) / 4)
if orientation == 3:
if ((k + l) < 30):
pixels[i + k, l + j] = ((i + k) / 4, 255, (l + j) / 4)
img.show()
img.save('paternCreator.jpeg','jpeg')