Skip to content

Instantly share code, notes, and snippets.

@shiweifu
Last active January 2, 2016 11:19
Show Gist options
  • Select an option

  • Save shiweifu/8295978 to your computer and use it in GitHub Desktop.

Select an option

Save shiweifu/8295978 to your computer and use it in GitHub Desktop.
使用convert 裁剪图片,支持批量处理
import sh
import sys
cfgfile = sys.argv[-1]
for line in open(cfgfile):
line = line.strip()
split_line = line.split(',')
print(split_line)
in_file = split_line[0]
out_file = split_line[1]
arg = split_line[2]
sh.convert('-resize', arg, in_file, out_file)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment