b7d7665fde
+ moved uis into own files + log is not rerendered in full anymore
21 lines
481 B
Python
21 lines
481 B
Python
from PIL import Image
|
|
import os
|
|
import sys
|
|
|
|
TARGET = (480, 800)
|
|
INPUT_DIR = sys.argv[1] if len(sys.argv) > 1 else "."
|
|
EXTENSIONS = {".jpg", ".jpeg", ".png", ".webp", ".bmp"}
|
|
|
|
for filename in os.listdir(INPUT_DIR):
|
|
ext = os.path.splitext(filename)[1].lower()
|
|
if ext not in EXTENSIONS:
|
|
continue
|
|
|
|
path = os.path.join(INPUT_DIR, filename)
|
|
img = Image.open(path)
|
|
|
|
img.thumbnail(TARGET, Image.LANCZOS)
|
|
|
|
img.save(path)
|
|
print(f"{filename}: {img.size}")
|