13 lines
438 B
Python
13 lines
438 B
Python
import glob, os
|
|
from PIL import Image, ImageOps
|
|
src = sorted(glob.glob("input/foto's/*.jpeg"))
|
|
os.makedirs("public/images", exist_ok=True)
|
|
for i, p in enumerate(src, 1):
|
|
im = ImageOps.exif_transpose(Image.open(p)).convert("RGB")
|
|
w, h = im.size
|
|
if w > 1600:
|
|
im = im.resize((1600, round(h*1600/w)))
|
|
out = f"public/images/werk-{i}.webp"
|
|
im.save(out, "WEBP", quality=82, method=6)
|
|
print("OK", out, im.size)
|