Fix bug in handling of --train-jpeg parameter.

main
Alex J. Champandard 9 years ago
parent 7c8cc5609f
commit fabe04f1d0

@ -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)

Loading…
Cancel
Save