forked from hkc/cc-stuff
1
0
Fork 0

Added missing random things

Mostly sample images and tiny scripts for weight calculation.
Nothing too of importance
This commit is contained in:
Casey 2024-10-05 14:27:07 +03:00
parent c45e9f88bc
commit 743435200d
Signed by: hkc
GPG Key ID: F0F6CFE11CDB0960
9 changed files with 25 additions and 0 deletions

BIN
cpi-images/casey.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 66 KiB

BIN
cpi-images/cute.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 94 KiB

BIN
cpi-images/n25.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 107 KiB

BIN
cpi-images/rando.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 96 KiB

BIN
cpi-images/rat.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 52 KiB

BIN
cpi-images/wp.cpi Normal file

Binary file not shown.

BIN
mess/avg.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 131 B

BIN
mess/cc_font.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

25
mess/gen-weights.py Normal file
View File

@ -0,0 +1,25 @@
from PIL import Image
from collections import Counter
with Image.open("./cc_font.png") as im:
pixels = im.load()
weights = [0 for _ in range(6 * 9)]
for char in range(256):
ctx, cty = (char % 16) * 8, (char // 16) * 11
for oy in range(9):
for ox in range(6):
pix = int(pixels[ctx + ox + 1, cty + oy + 1][0]) # type: ignore
weights[ox + 6 * oy] += 1 if pix else 0
with Image.new("L", (6, 9), 0) as im_out:
for y in range(9):
for x in range(6):
print("%3d" % weights[x + 6 * y], end="\t")
im_out.putpixel((x, y), weights[x + 6 * y])
print()
im_out.save("avg.png")
print(dict(enumerate([
iv[0] for iv in sorted(enumerate(weights), key=lambda iv: iv[1])
])))