"""Compile the generated four-tile upper-lounge material atlas.""" from pathlib import Path import struct from PIL import Image ROOT = Path(__file__).resolve().parents[2] sheet = Image.open(ROOT / "assets/sprites/hall/upper-materials-v1.png").convert("RGBA") frames = [sheet.crop((x*sheet.width//2,y*sheet.height//2, (x+1)*sheet.width//2,(y+1)*sheet.height//2)).resize((256,256),Image.Resampling.LANCZOS) for y in range(2) for x in range(2)] raw = b"".join(frame.tobytes("raw","BGRA") for frame in frames) (ROOT / "assets/animations/hall/upper-materials-v1.bin").write_bytes( struct.pack("<4s4I",b"ANM1",256,256,4,len(raw))+raw) print("Packed steel, marble, carpet and coffer materials")