Files
esp32_sd_lcd_image_viewer/helper/resize.py
T
Timo Niemann b7d7665fde + added helper scripts
+ moved uis into own files
+ log is not rerendered in full anymore
2026-07-01 15:11:25 +02:00

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}")