Files
ormakers-tronbyt/scripts/crop_logo.py
T

15 lines
414 B
Python

from PIL import Image
SRC = "/home/poprhythm/Downloads/main-logo.png"
OUT = "/home/poprhythm/ormakers-tronbyt-app/images/logo.png"
img = Image.open(SRC).convert("RGBA")
w, h = img.size
size = max(w, h)
square = Image.new("RGBA", (size, size), (0, 0, 0, 0))
square.paste(img, ((size - w) // 2, (size - h) // 2))
square.resize((64, 64), Image.LANCZOS).save(OUT)
print(f"source: {w}x{h}, output: 64x64 -> {OUT}")