Skip to content
This repository has been archived by the owner on Jan 2, 2021. It is now read-only.

Commit

Permalink
Fix exception when training with JPEG compression.
Browse files Browse the repository at this point in the history
  • Loading branch information
alexjc committed Nov 12, 2016
1 parent 9d2aa3c commit 559e66b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion enhance.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ def add_to_buffer(self, f):
seed = seed.resize((orig.size[0]//args.zoom, orig.size[1]//args.zoom), resample=PIL.Image.LANCZOS)
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.save(buffer, format='jpeg', quality=args.train_jpeg[0]+random.randrange(-rng, +rng))
seed = PIL.Image.open(buffer)

orig = scipy.misc.fromimage(orig).astype(np.float32)
Expand Down

0 comments on commit 559e66b

Please sign in to comment.