website/import_mess/resize_batch.py
2022-09-28 22:49:59 +02:00

16 lines
358 B
Python

#!/bin/python3
import subprocess
import glob
"""
check recursively every directory
for each image, create resize
"""
for f in glob.iglob('../static/files/images/**/*.jpg', recursive=True):
parent_dir = '/'.join(f.split('/')[:-1])
print(parent_dir)
subprocess.call(['convert', f, '-resize', '350x', parent_dir + '/' + 'thumb-250.jpg'])