Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # t_webp2jpg_plus.py
- from tkFileDialog import askdirectory
- folder = askdirectory() # needs to be placed after pack()
- import os
- from PIL import Image
- filenames = os.listdir(folder)
- print(folder)
- print
- extensions = '.jpg .jpeg .png'.split()
- for file in filenames:
- f = folder+'/'+file
- if file.endswith('.webp'):
- print('***\t\t'+file)
- f = folder+'/'+file
- img = Image.open(f).convert('RGB')
- img.save(f.rsplit('.',1)[0]+'.jpg', 'jpeg')
- elif file.endswith('.jpg_large'):
- print('***\t\t'+file)
- os.rename(f,f.rsplit('.jpg',1)[0]+'.jpg')
- elif file.endswith('.jpeg_large'):
- print('***\t\t'+file)
- os.rename(f,f.rsplit('.jepg',1)[0]+'.jpg')
- else:
- print(f)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement