Skip to content

Commit

Permalink
Fix #14
Browse files Browse the repository at this point in the history
  • Loading branch information
tsurumeso committed Mar 21, 2019
1 parent fbb3354 commit f69a30f
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions waifu2x.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,19 +172,20 @@ def load_models(cfg):
filelist = [args.input]

for path in filelist:
src = Image.open(path)
w, h = src.size[:2]
if args.width != 0:
args.scale_ratio = args.width / w
if args.height != 0:
args.scale_ratio = args.height / h
outname, ext = os.path.splitext(os.path.basename(path))
outpath = os.path.join(
args.output_dir, '{}.{}'.format(outname, args.extension))
if ext.lower() in extensions:
outname += '_(tta{})'.format(args.tta_level) if args.tta else '_'
src = Image.open(path)
w, h = src.size[:2]
if args.width != 0:
args.scale_ratio = args.width / w
if args.height != 0:
args.scale_ratio = args.height / h

dst = src.copy()
start = time.time()
outname += '_(tta{})'.format(args.tta_level) if args.tta else '_'
if 'noise_scale' in models:
outname += '(noise{}_scale{:.1f}x)'.format(
args.noise_level, args.scale_ratio)
Expand Down

0 comments on commit f69a30f

Please sign in to comment.