Files
Diabolo/tools/make_gait_preview_v18.py

17 lines
868 B
Python

from pathlib import Path
from PIL import Image
import shutil
root=Path(__file__).resolve().parent.parent
source=root/'Demon_v0.18_Windows/captures/v018'
target=root/'Demon_v0.18/captures/v018'
target.mkdir(parents=True,exist_ok=True)
for prefix,count,name in [('catwalk-',48,'catwalk-preview.webp'),('catwalk-side-',24,'catwalk-side-preview.webp')]:
frames=[]
for i in range(count):
with Image.open(source/f'{prefix}{i:02}.png') as image:frames.append(image.convert('RGB').resize((960,540),Image.Resampling.LANCZOS))
frames[0].save(source/name,save_all=True,append_images=frames[1:],duration=42,loop=0,quality=82,method=4)
with Image.open(source/name) as image:assert image.n_frames==count
shutil.copy2(source/name,target/name)
print(name,(source/name).stat().st_size)
for name in ['catwalk-06.png','catwalk-side-12.png']:shutil.copy2(source/name,target/name)