Clean master
This commit is contained in:
parent
bb26b69d99
commit
383a0c1254
Binary file not shown.
Before Width: | Height: | Size: 1.7 KiB |
Binary file not shown.
Before Width: | Height: | Size: 18 KiB |
|
@ -1,39 +0,0 @@
|
|||
from PIL import Image
|
||||
import numpy as np
|
||||
|
||||
|
||||
def analyse(index, pxl):
|
||||
if pxl[0] == 255: return 0
|
||||
else:
|
||||
if index < 18 or index > 52: return 1
|
||||
if 24 < index < 40: return 3
|
||||
else: return 2
|
||||
|
||||
|
||||
def show():
|
||||
img = Image.open("world.png")
|
||||
data = np.array(img)
|
||||
|
||||
rslt = ""
|
||||
for index, line in enumerate(data):
|
||||
for pxl in line:
|
||||
rslt += f"{analyse(index, pxl)}"
|
||||
rslt += "\n"
|
||||
print(rslt)
|
||||
|
||||
|
||||
def get_tabular():
|
||||
img = Image.open("world.png")
|
||||
data = np.array(img)
|
||||
|
||||
rslt = "const unsigned int world[64][128] =\n{"
|
||||
for index, line in enumerate(data):
|
||||
rslt += "\n {"
|
||||
for pxl in line:
|
||||
rslt += f"{analyse(index, pxl)}, "
|
||||
rslt = rslt[:-2] + "},"
|
||||
rslt += "\n};"
|
||||
print(rslt)
|
||||
|
||||
|
||||
get_tabular()
|
Binary file not shown.
Before Width: | Height: | Size: 3.8 KiB |
Binary file not shown.
Before Width: | Height: | Size: 2.2 KiB |
Loading…
Reference in New Issue