# Turns the raw pictures into the game's high-res tiles (run from this folder with Pillow): # (name, variants (1: one seamless tile), crop margin as a share of the picture, brightness) import subprocess, sys from PIL import Image T = '../../../../tools/make_tile.py' D = '../../../../tools/make_decal.py' TILES = [ ('reinforced', 5, 0.25, 1.15), ('fortwall', 4, 0.25, 1.0), ('steel', 4, 0.2, 1.1), ('obsidian', 4, 0.15, 1.0), ('face', 1, 0.15, 1.0), ('treasury', 4, 0.12, 1.1), ('lair', 4, 0.1, 1.0), ('farm', 4, 0.1, 1.1), ('training', 4, 0.18, 1.1), ('library', 4, 0.18, 1.25), ('torture', 4, 0.15, 1.15), ('temple', 4, 0.12, 1.2), ('prison', 4, 0.12, 1.1), ('graveyard', 4, 0.1, 1.1), ('guardpost', 4, 0.12, 1.0), ('arena', 4, 0.12, 1.0), ('altar', 4, 0.08, 1.3), ('forge', 4, 0.12, 1.1), ('aerie', 4, 0.15, 1.0), ('core', 4, 0.12, 1.1), ('portal', 4, 0.12, 1.15), ('gate', 4, 0.15, 1.0), ('hero', 4, 0.2, 1.0), ('bridge', 2, 0.15, 1.1), ('stonebridge', 2, 0.15, 1.0), ('grass', 4, 0.1, 1.0), ('snow', 4, 0.15, 1.0), ('moss', 4, 0.1, 1.1), ('leaves', 2, 0.1, 1.0), ('bark', 1, 0.1, 1.0), ('stem', 1, 0.1, 1.0), ('cap', 1, 0.1, 1.0), ] OBJS = ['coins', 'silver', 'ruby', 'diamond', 'mushroom', 'shard'] P = [sys.executable, '-I'] for name, n, m, br in TILES: im = Image.open(f'{name}-raw.png').convert('RGB') w = im.width im.crop((int(w * m), int(w * m), int(w * (1 - m)), int(w * (1 - m)))).save(f'/tmp/{name}-crop.png') for size, colors, band in [(256, 48, 28), (128, 32, 14)]: if n > 1: subprocess.run(P + [T, f'/tmp/{name}-crop.png', name, '--size', str(size), '--colors', str(colors), '--band', str(band), '--variants', str(n), '--bright', str(br)], check=True, capture_output=True) else: # one tile of size/2: the whole picture made seamless at that size subprocess.run(P + [T, f'/tmp/{name}-crop.png', name, '--size', str(size // 2), '--colors', str(colors), '--band', str(band // 2), '--bright', str(br)], check=True, capture_output=True) Image.open(f'{name}-{size // 2}.png').save(f'{name}-v{size // 2}.png') for name in OBJS: for size in (64, 128): subprocess.run(P + [D, f'obj-{name}-raw.png', f'obj-{name}', '--size', str(size)] + (['--strict'] if name == 'shard' else []), check=True, capture_output=True) print('done')