12345678910111213
from PIL import ImageFileNames=os.listdir('images') #image文件夹i = 0for imgfile in FileNames: if imgfile!='.DS_Store' and imgfile!='orgin_croped': img = Image.open("images/%s"%(imgfile)) region = (344,344,750,830) #数字请自行调整 print("图片宽{0}px,高{1}px".format(img.size[0],img.size[1])) #裁切图片 cropImg = img.crop(region) cropImg.save('imagesCroped/%s'%(imgfile))
赶紧升级浏览器来访问本站吧!现在就去
×