pokemon/tools/png_size.py

16 lines
368 B
Python

import sys
from PIL import Image
out_path = sys.argv[1]
in_path = sys.argv[2]
im = Image.open(in_path)
width, height = im.size
assert width % 8 == 0, width
assert width <= 255, width
assert height <= 255, height
with open(out_path, 'w') as f:
f.write(f"static constexpr uint8_t width = {width};\n")
f.write(f"static constexpr uint8_t height = {height};\n")