Browse Source

Fix ZeroDivisionError when ExposureTime contains null values (fix #193)

pull/195/head
Simon Conseil 10 years ago
parent
commit
b4d1057a58
  1. 2
      sigal/image.py
  2. 6
      tests/test_image.py

2
sigal/image.py

@ -263,6 +263,8 @@ def get_exif_tags(data):
except IndexError:
# Pillow == 3.0
simple['exposure'] = exptime[0]
except ZeroDivisionError:
logger.info('Invalid ExposureTime: %r', exptime)
elif isinstance(exptime, int):
simple['exposure'] = str(exptime)
else:

6
tests/test_image.py

@ -137,6 +137,12 @@ def test_get_exif_tags():
assert 'gps' not in simple
def test_null_exposure_time():
data = {'ExposureTime': (0, 0)}
simple = get_exif_tags(data)
assert 'exposure' not in simple
def test_exif_copy(tmpdir):
"Test if EXIF data can transfered copied to the resized image."

Loading…
Cancel
Save