Initial commit: RE tooling and docs for The I of the Dragon localization/HD
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
from PIL import Image
|
||||
import sys
|
||||
p = sys.argv[1]
|
||||
cols = int(sys.argv[2]) if len(sys.argv) > 2 else 120
|
||||
img = Image.open(p).convert("L")
|
||||
W, H = img.size
|
||||
rows = max(1, int(cols * H / W / 2.1))
|
||||
img2 = img.resize((cols, rows))
|
||||
px = img2.load()
|
||||
ramp = " .:-=+*#%@"
|
||||
for y in range(rows):
|
||||
line = ""
|
||||
for x in range(cols):
|
||||
v = px[x, y]
|
||||
line += ramp[min(9, (255 - v) * 10 // 256)]
|
||||
print(line)
|
||||
print("size", W, H, "->", cols, rows)
|
||||
Reference in New Issue
Block a user