12 lines
402 B
Python
Executable file
12 lines
402 B
Python
Executable file
#!/usr/bin/python3
|
|
import sys
|
|
import pathlib
|
|
import subprocess
|
|
|
|
SIZES = [(320, 240), (480, 360), (640, 480)]
|
|
|
|
image_path = pathlib.Path(sys.argv[1])
|
|
for width, height in SIZES:
|
|
thumb_name = image_path.with_name(f"{image_path.stem}_{height}.webp")
|
|
print(f"Generating {width}x{height} at {thumb_name}")
|
|
subprocess.run(["convert", str(image_path), "-resize", f"{width}x{height}", thumb_name])
|