KAZIK/tools/generators/prepare_cinematic_v3.py

28 lines
1 KiB
Python

"""Rebuild the native city source used by the editable After Effects project."""
import argparse
from pathlib import Path
import subprocess
import sys
from PIL import Image
ROOT=Path(__file__).resolve().parents[2]
def main():
parser=argparse.ArgumentParser()
parser.add_argument('--reuse-capture',action='store_true')
args=parser.parse_args()
if not args.reuse_capture:
subprocess.run([sys.executable,'tools/tests/check_presentation.py','--procedural'],cwd=ROOT,check=True)
target=ROOT/'build/cinematic-v3/native-city';target.mkdir(parents=True,exist_ok=True)
(ROOT/'build/cinematic-v3/render').mkdir(parents=True,exist_ok=True)
for index in range(240):
source=ROOT/f'build/scratch/boot-motion-{index+160:03}.bgra'
im=Image.frombytes('RGBA',(640,480),source.read_bytes(),'raw','BGRA').convert('RGB')
im.paste((0,0,0),(0,448,640,480))
im.save(target/f'city_{index:04}.png')
print('Prepared 240 original native city frames for the AE project')
if __name__=='__main__':
main()