"""Pack approved ImageGen cinema art. Runtime camera/compositing lives in MASM.""" import json from pathlib import Path import struct from PIL import Image ROOT = Path(__file__).resolve().parents[2] def main(): specs = [('roulette-cinematic-v1', (512,512)), ('eblan-cinematic-v2', (640,427)), ('casino-cinematic-v2', (640,215))] manifest = [] for name, size in specs: source = ROOT/'assets/sprites/intro'/(name+'.png') im = Image.open(source).convert('RGBA') # Crop the supplied alpha, preserving the original glow and smoke. box = im.getchannel('A').point(lambda v: 255 if v > 8 else 0).getbbox() im = im.crop(box).resize(size, Image.Resampling.LANCZOS) payload = im.tobytes('raw','BGRA') target = ROOT/'assets/animations/intro'/(name+'.bin') target.write_bytes(struct.pack('<4s4I',b'ANM1',*size,1,len(payload))+payload) manifest.append(dict(source=str(source.relative_to(ROOT)), pack=str(target.relative_to(ROOT)),size=size, alpha='original ImageGen alpha, preserved')) (ROOT/'assets/animations/intro/manifest-cinematic-v2.json').write_bytes( (json.dumps(manifest,indent=2)+'\n').encode('utf-8')) print('Packed three cinematic assets; no frame sequence or video runtime.') if __name__ == '__main__': main()