ubuntustudio-bugs team mailing list archive
-
ubuntustudio-bugs team
-
Mailing list archive
-
Message #00516
[Bug 1354196] [NEW] geotag action crash when trying to write the Exif_GPSInfo_GPSAltitudeRef tag
Public bug reported:
source package:
**************
phatch-cli
ubuntu release:
**************
Description: Ubuntu 14.04 LTS
Release: 14.04
version:
*******
phatch:
Instalados: 0.2.7.1-3
Candidato: 0.2.7.1-3
Tabla de versión:
*** 0.2.7.1-3 0
500 http://es.archive.ubuntu.com/ubuntu/ trusty/universe amd64 Packages
100 /var/lib/dpkg/status
When trying to assing goetags to photos using a GARMIN GPX file y get
this error for every photo (spanish version, sorry) and no geotag is
modified:
Error 0:No se puede aplicar la acción Geoetiqueta a la imagen 'photo.JPG' en la carpeta:
/Testing/PhotoFolder
u'Imposible escribir marca "Exif_GPSInfo_GPSAltitudeRef":\nInvalid value
for EXIF type [Byte]: [0]'
Action:{'fields': {'GPS Data (gpx)': u'/GPSTrack.gpx',
'GPS Report (csv)': ' ',
'Time Shift (seconds)': u'60',
'__enabled__': 'yes'},
'label': 'Geotag'}
Traceback (most recent call last):
File "/usr/share/phatch/phatch/core/api.py", line 614, in apply_action_to_photo
photo = action.apply(photo, read_only_settings, cache)
File "/usr/share/phatch/phatch/actions/geotag.py", line 75, in apply
info[key.replace('.', '_')] = value # writable
File "/usr/share/phatch/phatch/core/pil.py", line 365, in __setitem__
% (_('Impossible to write tag "%s"') % tag, message))
KeyError: u'Imposible escribir marca "Exif_GPSInfo_GPSAltitudeRef":\nInvalid value for EXIF type [Byte]: [0]'
*
The problem is that 'Exif_GPSInfo_GPSAltitudeRef' tag uses a byte type value while phatch is trying to write a int type value (eleR):
---------------------------------------------------------
in GPS.py at line 203
latR = 'N'
lonR = 'E'
eleR = 0
if lat < 0:
lat = -lat
latR = 'S'
if lon < 0:
lon = -lon
lonR = 'W'
sele = "%6.1f" % (ele)
if ele < 0:
ele = -ele
eleR = 1
slat = "%02d.%02d'" '%02d"%s' % (d(lat), m(lat), s(lat), latR)
slon = "%02d.%02d'" '%02d"%s' % (d(lon), m(lon), s(lon), lonR)
if report:
report.write(",".join([stamp, timestamp, slat, slon, sele, path])\
+ "\n")
# get Rational number for ele
# don't know why r(ele) is causing trouble!
# it might be that the denominator is overflowing 32 bits!
# and this would also import lat and lon
rele = pyexiv2.Rational(int(ele * 10.0), 10)
# create and return the dictionary of tags to be added to the image
metadata = {}
metadata['Exif_GPSInfo_GPSAltitude'] = rele
metadata['Exif_GPSInfo_GPSAltitudeRef'] = eleR:
---------------------------------------------------------
I have solved the problem by transforming eleR to byte with the bytes()
constructor:
metadata['Exif_GPSInfo_GPSAltitudeRef'] = bytes(eleR)
** Affects: phatch (Ubuntu)
Importance: Undecided
Status: New
** Attachment added: "action list for phatch"
https://bugs.launchpad.net/bugs/1354196/+attachment/4172312/+files/gpsLaunchpad.phatch
--
You received this bug notification because you are a member of Ubuntu
Studio Bugs, which is subscribed to phatch in Ubuntu.
Matching subscriptions: Ubuntu Studio Bugs
https://bugs.launchpad.net/bugs/1354196
Title:
geotag action crash when trying to write the
Exif_GPSInfo_GPSAltitudeRef tag
Status in “phatch” package in Ubuntu:
New
Bug description:
source package:
**************
phatch-cli
ubuntu release:
**************
Description: Ubuntu 14.04 LTS
Release: 14.04
version:
*******
phatch:
Instalados: 0.2.7.1-3
Candidato: 0.2.7.1-3
Tabla de versión:
*** 0.2.7.1-3 0
500 http://es.archive.ubuntu.com/ubuntu/ trusty/universe amd64 Packages
100 /var/lib/dpkg/status
When trying to assing goetags to photos using a GARMIN GPX file y get this error for every photo (spanish version, sorry) and no geotag is modified:
Error 0:No se puede aplicar la acción Geoetiqueta a la imagen 'photo.JPG' en la carpeta:
/Testing/PhotoFolder
u'Imposible escribir marca "Exif_GPSInfo_GPSAltitudeRef":\nInvalid
value for EXIF type [Byte]: [0]'
Action:{'fields': {'GPS Data (gpx)': u'/GPSTrack.gpx',
'GPS Report (csv)': ' ',
'Time Shift (seconds)': u'60',
'__enabled__': 'yes'},
'label': 'Geotag'}
Traceback (most recent call last):
File "/usr/share/phatch/phatch/core/api.py", line 614, in apply_action_to_photo
photo = action.apply(photo, read_only_settings, cache)
File "/usr/share/phatch/phatch/actions/geotag.py", line 75, in apply
info[key.replace('.', '_')] = value # writable
File "/usr/share/phatch/phatch/core/pil.py", line 365, in __setitem__
% (_('Impossible to write tag "%s"') % tag, message))
KeyError: u'Imposible escribir marca "Exif_GPSInfo_GPSAltitudeRef":\nInvalid value for EXIF type [Byte]: [0]'
*
The problem is that 'Exif_GPSInfo_GPSAltitudeRef' tag uses a byte type value while phatch is trying to write a int type value (eleR):
---------------------------------------------------------
in GPS.py at line 203
latR = 'N'
lonR = 'E'
eleR = 0
if lat < 0:
lat = -lat
latR = 'S'
if lon < 0:
lon = -lon
lonR = 'W'
sele = "%6.1f" % (ele)
if ele < 0:
ele = -ele
eleR = 1
slat = "%02d.%02d'" '%02d"%s' % (d(lat), m(lat), s(lat), latR)
slon = "%02d.%02d'" '%02d"%s' % (d(lon), m(lon), s(lon), lonR)
if report:
report.write(",".join([stamp, timestamp, slat, slon, sele, path])\
+ "\n")
# get Rational number for ele
# don't know why r(ele) is causing trouble!
# it might be that the denominator is overflowing 32 bits!
# and this would also import lat and lon
rele = pyexiv2.Rational(int(ele * 10.0), 10)
# create and return the dictionary of tags to be added to the image
metadata = {}
metadata['Exif_GPSInfo_GPSAltitude'] = rele
metadata['Exif_GPSInfo_GPSAltitudeRef'] = eleR:
---------------------------------------------------------
I have solved the problem by transforming eleR to byte with the
bytes() constructor:
metadata['Exif_GPSInfo_GPSAltitudeRef'] = bytes(eleR)
To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/phatch/+bug/1354196/+subscriptions
Follow ups
References