diff --git a/enhance.py b/enhance.py index ecd8afc..66fd1fe 100755 --- a/enhance.py +++ b/enhance.py @@ -180,7 +180,7 @@ class DataLoader(threading.Thread): seed = seed.filter(PIL.ImageFilter.GaussianBlur(radius=random.randint(0, args.train_blur*2))) if args.zoom > 1: seed = seed.resize((orig.size[0]//args.zoom, orig.size[1]//args.zoom), resample=PIL.Image.LANCZOS) - if args.train_jpeg is not None: + if len(args.train_jpeg) > 0: buffer, rng = io.BytesIO(), args.train_jpeg[-1] if len(args.train_jpeg) > 1 else 15 seed.save(buffer, format='jpeg', quality=args.train_jpeg+random.randrange(-rng, +rng)) seed = PIL.Image.open(buffer)