Add AI Spine animation pipeline

This commit is contained in:
2026-09-12 13:06:59 +08:00
commit b32fae2d48
18 changed files with 659 additions and 0 deletions
+23
View File
@@ -0,0 +1,23 @@
#!/usr/bin/env python3
"""Prepare a reference for feature matching without changing its artwork."""
import argparse
from pathlib import Path
from PIL import Image
def main():
p = argparse.ArgumentParser()
p.add_argument('--input', required=True)
p.add_argument('--output', required=True)
p.add_argument('--target', type=int, default=1024)
a = p.parse_args()
im = Image.open(a.input).convert('RGBA')
longest = max(im.width, im.height)
if longest < a.target:
scale = a.target / longest
size = (max(1, round(im.width * scale)), max(1, round(im.height * scale)))
# Nearest-neighbour preserves pixel-art edges and transparency.
im = im.resize(size, Image.Resampling.NEAREST)
im.save(a.output)
print(f'Reference prepared: {im.width}x{im.height}')
if __name__ == '__main__': main()