使用python批量更改图片尺寸

in cn •  7 years ago  (edited)

dev.py.png

批量把当前目录下的jpg文件的宽度改为1920

import os
import glob
import subprocess
files = glob.glob('*.jpg')
for file in files:
    fname, fext = os.path.splitext(file)
    cmd = "img_cv -resize 1920x "+ file + " " + fname + "_1" + fext
    subprocess.call(['cmd', '/c', cmd])
Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE STEEM!
Sort Order:  
Loading...