Initial commit

This commit is contained in:
Niles Rogoff 2017-01-27 16:38:31 -05:00
commit 76cd1d1650
No known key found for this signature in database
GPG Key ID: B78B908F23430F80
2 changed files with 31 additions and 0 deletions

11
README.md Normal file
View File

@ -0,0 +1,11 @@
## Upscale Wrapper
### Usage
`upscale <infile> [outfile] [noise reduction level]`
If outfile is not given, it will try to guess.
Valid values for the noise reduction argument are `0`, `1` and `2`, with 0 being off and 2 being the most aggressive. The default is off
It will try to upscale it 2x.

20
upscale.py Executable file
View File

@ -0,0 +1,20 @@
#!/usr/bin/env python3
# waifu2x-converter-cpp -j 2 --scale_ratio 2.0 --noise_level 2 -m noise_scale -o mpv-shot0011.png -i mpv-shot0011.jpg
import subprocess, sys, os
null = open(os.devnull, "w")
infile = sys.argv[1]
outfile = ".".join(sys.argv[1].split(".")[:-1]) + "-waifu2x.png"
noise_level = False
if len(sys.argv) > 2:
outfile = sys.argv[2]
if len(sys.argv) > 3:
noise_level = int(sys.argv[3])
if not noise_level or noise_level == 0:
noise_level = ["-m", "scale"]
else:
noise_level = ["-m", "noise_scale", "--noise_level", str(noise_level)]
args = ["waifu2x-converter-cpp", "-j", "2", *noise_level, "-o", outfile, "-i", infile]
print(" ".join(args))
subprocess.call(args, stdout=null)
null.close()
print("Written to " + outfile)