Skip to content

Commit

Permalink
Ignore EXIF read error (#73)
Browse files Browse the repository at this point in the history
  • Loading branch information
shonohs authored Oct 19, 2023
1 parent 319d75f commit c006433
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import setuptools
from os import path

VERSION = '1.0.8'
VERSION = '1.0.9'

# Get the long description from the README file
here = path.abspath(path.dirname(__file__))
Expand Down
7 changes: 6 additions & 1 deletion vision_datasets/common/data_reader/image_loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,12 @@ def load_from_stream(f):
image = Image.open(f)
img_format = image.format

exif = image.getexif()
try:
exif = image.getexif()
except Exception as e:
logger.warning(f'Failed to get EXIF from an image: {e}')
exif = None

orientation = exif.get(ORIENTATION_EXIF_TAG) if exif else None
if orientation:
# orientation is 1 based, shift to zero based and flip/transpose based on 0-based values
Expand Down

0 comments on commit c006433

Please sign in to comment.