HearingGame/assets/images/imagegen.py

18 lines
652 B
Python
Raw Normal View History

2023-04-01 08:08:45 +02:00
def getRGBfromI(RGBint):
blue = RGBint & 255
green = (RGBint >> 8) & 255
red = (RGBint >> 16) & 255
return red, green, blue
mx = pow(2,24)-1 # i.e. 16777215
x = 0
alphabet = ["A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"]
interval = int(mx/(len(alphabet)))
with open("gen.sh", "w") as f:
for i in range(0, len(alphabet)):
red, green, blue = getRGBfromI(i*interval)
letter = alphabet[x]
f.write("convert -size 32x32 xc:rgb\(" + str(red) + "," + str(green) + "," + str(blue) + "\) " + letter +".png\n")
x = x + 1