1
0
Fork 0
mirror of https://github.com/Findus23/plugin-ProfileAvatar.git synced 2024-09-19 15:23:45 +02:00
plugin-ProfileAvatar/images/CatAvatar/convert.py
2020-05-20 10:41:04 +02:00

22 lines
446 B
Python

# unzip .ora
from pathlib import Path
from xml.etree import ElementTree
from PIL import Image
dir = Path("./cat_src")
out = Path("./out/")
out.mkdir(exist_ok=True)
xml = dir / "stack.xml"
root = ElementTree.parse(xml).getroot()
for image in root.findall("stack/layer"):
im = Image.open(dir / image.get("src"))
to = out / (image.get("name") + ".png")
im = im.resize((240, 240), Image.ANTIALIAS)
im.save(to)
print(image)