from pathlib import Path

from PIL import Image

ROOT = Path("/home/ubuntu/etqan-gateway-app/assets/images")
FILES = ["icon.png", "splash-icon.png", "favicon.png", "android-icon-foreground.png"]

for name in FILES:
    path = ROOT / name
    image = Image.open(path).convert("RGB")
    image.thumbnail((768, 768), Image.Resampling.LANCZOS)
    image.save(path, "PNG", optimize=True, compress_level=9)
