initial commit
This commit is contained in:
parent
8ff895fe05
commit
7634a1bd79
|
@ -0,0 +1,42 @@
|
|||
from PIL import Image
|
||||
import numpy as np
|
||||
import random
|
||||
|
||||
def cv(min=0,max=255):
|
||||
return random.randint(min,max)
|
||||
|
||||
leng = 0
|
||||
color1 = [cv(min=200),cv(),cv()]
|
||||
color2 = [cv(),cv(),cv()]
|
||||
|
||||
print(color1)
|
||||
print(color2)
|
||||
|
||||
w, h = 2084, 1024
|
||||
data = np.zeros((h, w, 3), dtype='uint8')
|
||||
|
||||
|
||||
def newvals():
|
||||
deltas = [0,0,0]
|
||||
leng = random.randint(40, 1000)
|
||||
for i in range(3):
|
||||
deltas[i] = float((color2[i] - color1[i])/leng)
|
||||
return leng, deltas
|
||||
|
||||
|
||||
|
||||
for x in data:
|
||||
cursor = 0
|
||||
leng, deltas = newvals()
|
||||
for y in x:
|
||||
for i in range(3):
|
||||
y[i] = int(min(color1[i] + (deltas[i] * cursor), 255) * float(cursor/leng))
|
||||
cursor += 1
|
||||
if cursor > leng:
|
||||
cursor = 0
|
||||
leng, deltas = newvals()
|
||||
|
||||
img = Image.fromarray(data, 'RGB')
|
||||
img = img.rotate(270, expand=True)
|
||||
img.save('my.png')
|
||||
img.show()
|
Loading…
Reference in New Issue