|
分享源码
界面截图: |
- |
是否带模块: |
纯源码 |
备注说明: |
- |
import os
from PIL import Image
myPath = 'E:\中文字符'
outPath = 'E:/中文_缩放/'
def processImage(filesource, destsource, name, imgtype):
imgtype = 'jpeg' if imgtype == '.jpg' else 'png'
im = Image.open(name)
out = im.resize((100,100))
out.save(destsource + name,)
def run():
os.chdir(myPath)
for i in os.listdir(os.getcwd()):
postfix = os.path.splitext(i)[1]
print(postfix,i)
if postfix == '.jpg' or postfix == '.png':
processImage(myPath, outPath, i, postfix)
if __name__ == '__main__':
run()
|
|