geolocate: lift Pillow version limit (#44633)

This commit is contained in:
Valentin Deniaud 2020-08-13 11:18:38 +02:00 committed by Frédéric Péters
parent 48cdfe3721
commit a9b4e8f85b
2 changed files with 9 additions and 3 deletions

View File

@ -29,7 +29,7 @@ deps =
requests
vobject
qrcode
Pillow<7.2
Pillow
workalendar
python-magic
docutils

View File

@ -20,6 +20,7 @@ import json
try:
from PIL import Image
from PIL.ExifTags import TAGS, GPSTAGS
from PIL.TiffImagePlugin import IFDRational
except ImportError:
Image = None
@ -197,8 +198,13 @@ class GeolocateWorkflowStatusItem(WorkflowStatusItem):
lon_ref = gps_info[3]
except KeyError:
lon_ref = 'E'
lat = (1.0*lat[0][0]/lat[0][1] + 1.0*lat[1][0]/lat[1][1]/60 + 1.0*lat[2][0]/lat[2][1]/3600)
lon = (1.0*lon[0][0]/lon[0][1] + 1.0*lon[1][0]/lon[1][1]/60 + 1.0*lon[2][0]/lon[2][1]/3600)
if isinstance(lat[0], IFDRational):
lat = (1.0 * lat[0] + 1.0 * lat[1]/60 + 1.0 * lat[2]/3600)
lon = (1.0 * lon[0] + 1.0 * lon[1]/60 + 1.0 * lon[2]/3600)
else:
# Pillow < 7.2 compat
lat = (1.0*lat[0][0]/lat[0][1] + 1.0*lat[1][0]/lat[1][1]/60 + 1.0*lat[2][0]/lat[2][1]/3600)
lon = (1.0*lon[0][0]/lon[0][1] + 1.0*lon[1][0]/lon[1][1]/60 + 1.0*lon[2][0]/lon[2][1]/3600)
if lat_ref == 'S':
lat = -lat
if lon_ref == 'W':