Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import PIL
- from PIL import Image
- import os
- import subprocess as sub
- coef = 0.45
- waifu2xCaffeExe = 'C:\\Programmes\\waifu2x-caffe\\waifu2x-caffe-cui.exe'
- picFolder = os.getcwd()
- waifuOption = '-m noise_scale -s 4 -n 3 -p cudnn -q 100'
- fileList = os.listdir()
- for file in fileList:
- if( ".jpg" in file):
- print(file)
- img = Image.open(file)
- size = int((float(img.size[0]) * coef)),int((float(img.size[1]) * coef))
- img = img.resize(size, PIL.Image.ANTIALIAS)
- img.save('smaller-'+file,quality=100)
- print("waifu2x-caffe-cui.exe -i "+picFolder+"\\smaller-"+file + " -o "+picFolder+"\\waifu2x-"+file + " " + waifuOption)
- sub.check_call(waifu2xCaffeExe
- + " -i "+picFolder+"\\smaller-"+file
- + " -o "+picFolder+"\\waifu2x-"+file
- + " " + waifuOption
- , shell=True)
Advertisement
Add Comment
Please, Sign In to add comment