Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion image_to_numpy/src.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,18 @@ def load_image_file(file, mode='RGB'):

if hasattr(PIL.ImageOps, 'exif_transpose'):
# Very recent versions of PIL can do exit transpose internally
img = PIL.ImageOps.exif_transpose(img)

# PIL.ImageOps.exif_transpose() is raising an exception.
# perform exif_transpose() manually until it gets fixed.
try:

img = PIL.ImageOps.exif_transpose(img)

except:

img = PIL.Image.open(file)
img = exif_transpose(img)

else:
# Otherwise, do the exif transpose ourselves
img = exif_transpose(img)
Expand Down