crtjs/tapes/sample/generator.py
2021-01-26 02:01:59 +01:00

27 lines
No EOL
448 B
Python

import random
def rand():
dec = random.randint(0,255)
tohex = str(hex(dec).split("x")[-1])
if(dec < 16):
tohex = "0" + tohex
return tohex
def randomColor():
pixel = rand() + rand() + rand()
return f"\"#{pixel}\""
# ----
file = open("data.json","a+")
file.write("[")
# 3 Seconds of 64x64px@10fps uncompressed video (~7MB)
for x in range(737280):
file.write(randomColor() + ",")
file.write(randomColor())
file.write("]")
file.close()