Skip to content

Commit

Permalink
Adapting image.py to 16 bits gray
Browse files Browse the repository at this point in the history
Avoid needless downsampling of 16 bits gray image to 8 bits, and current clipping from Pillow is wrong, see :
python-pillow/Pillow#3011
  • Loading branch information
GuillaumeErhard committed Jun 28, 2018
1 parent 0c07b87 commit 0a150b5
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion keras_preprocessing/image.py
Original file line number Diff line number Diff line change
Expand Up @@ -472,7 +472,7 @@ def load_img(path, grayscale=False, target_size=None,
'The use of `array_to_img` requires PIL.')
img = pil_image.open(path)
if grayscale:
if img.mode != 'L':
if img.mode not in ('L', 'I;16'):
img = img.convert('L')
else:
if img.mode != 'RGB':
Expand Down

0 comments on commit 0a150b5

Please sign in to comment.