还记得我前面那个 体力活 吧,千多张bmp要全部旋转90度,并保存为png。现在想起来真是太恐怖了,我居然是一张一张去做的。其实使用 Python 和 PIL(Python Imaging Library) ,可以很简单的完成这类工作。 PIL并不是Python 2.5的默认包,需要另外安装。 #*coding=utf-8 import os import Image def ttimg(path): print 'process on:', path for name in os.listdir(path): if name != '.DS_Store': fullPath = os.path.join(path, name) if os.path.isfile(fullPath): (fileName, fileEx) = os.path.splitext(fullPath) if fileEx=='.bmp': img = Image.open(fullPath) ...