文件操作
1 import os, glob 2 from PIL import Image 3 4 path = 'D:/SBSR/view_1' 5 imgslist = glob.glob(path+'/*.jpg') 6 format = '.png' 7 def small_img(): 8 for imgs in imgslist: 9 imgspath, ext = os.path.splitext(imgs)10 img = Image.open(imgs)11 img.save(imgspath+format)12 print "done"13 14 if __name__ == '__main__':15 small_img()