fork download
  1. import os
  2. import glob
  3. from PIL import Image
  4.  
  5. i = 0
  6. dstPath = 'd:/output/comp/'
  7. srcPath = 'd:/input/'
  8.  
  9.  
  10. globPath = os.path.join(srcPath,'**')
  11. searchResult = glob.glob(globPath, recursive=True)
  12.  
  13. for file in searchResult:
  14. if os.path.isfile(file):
  15. if os.path.splitext(file)[1] in ['.JPG','.jpg']:
  16. i+=1
  17. srcPath = os.path.relpath(file)
  18. im = Image.open(file)
  19. im.save(os.path.join(dstPath,srcPath)
Runtime error #stdin #stdout #stderr 0.05s 62200KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
  File "prog.py", line 19
    im.save(os.path.join(dstPath,srcPath)
           ^
SyntaxError: parenthesis is never closed