Last active
January 26, 2021 00:31
-
-
Save VictorWesterlund/b4f279d45708196a92a4ddc7a677ff44 to your computer and use it in GitHub Desktop.
Generate a signed HEX video tape for crtjs using random RGB values
This file contains 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
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() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment