From 82e6732a33a105b5b701d4895c461f289c26a5ee Mon Sep 17 00:00:00 2001 From: DenisCarriere Date: Sun, 8 Feb 2015 03:06:55 -0500 Subject: [PATCH 1/4] #14 Add GPS tags --- pexif.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/pexif.py b/pexif.py index c3006b2..250c719 100644 --- a/pexif.py +++ b/pexif.py @@ -662,7 +662,19 @@ class IfdGPS(IfdData): 0x3: ("East or West Longitude", "GPSLongitudeRef", ASCII, 2), 0x4: ("Longitude", "GPSLongitude", RATIONAL, 3), 0x5: ("Altitude reference", "GPSAltitudeRef", BYTE, 1), - 0x6: ("Altitude", "GPSAltitude", RATIONAL, 1) + 0x6: ("Altitude", "GPSAltitude", RATIONAL, 1), + 0x7: ("UTC (Coordinated Universal Time)", "GPSTimeStamp", RATIONAL, 3), + 0x8: ("Satellites", "GPSSatellites", ASCII), + 0x9: ("Status", "GPSStatus", ASCII, 2), + 0xA: ("Measure Mode", "GPSMeasureMode", ASCII, 2), + 0xB: ("DOP (Data Degree of Precision)", "GPSDOP", RATIONAL, 1), + 0xC: ("Speed: [K]ilometers, [M]iles or [K]nots", "GPSSpeedRef", ASCII, 2), + 0xD: ("Speed", "GPSSpeed", RATIONAL, 1), + 0xE: ("Track Direction: [T]rue or [M]agnetic", "GPSTrackRef", ASCII, 2), + 0xF: ("Track Direction: (0.00 to 359.99)", "GPSTrack", RATIONAL, 1), + 0x10: ("Image Direction: [T]rue or [M]agnetic", "GPSImgDirectionRef", ASCII, 2), + 0x11: ("Image Direction: (0.00 to 359.99)", "GPSImgDirection", RATIONAL, 1), + 0x12: ("Datum: WGS-84", "GPSMapDatum", ASCII), } def __init__(self, e, offset, exif_file, mode, data=None): From b88b14e7b35eb45e16b2cec254ce37bfb3732f7e Mon Sep 17 00:00:00 2001 From: DenisCarriere Date: Sun, 8 Feb 2015 04:09:51 -0500 Subject: [PATCH 2/4] #14 #13 Add more Tags & function --- pexif.egg-info/PKG-INFO | 16 ++++++++++++ pexif.egg-info/SOURCES.txt | 20 +++++++++++++++ pexif.egg-info/dependency_links.txt | 1 + pexif.egg-info/top_level.txt | 1 + pexif.py | 38 ++++++++++++++++++++++++++++- 5 files changed, 75 insertions(+), 1 deletion(-) create mode 100644 pexif.egg-info/PKG-INFO create mode 100644 pexif.egg-info/SOURCES.txt create mode 100644 pexif.egg-info/dependency_links.txt create mode 100644 pexif.egg-info/top_level.txt diff --git a/pexif.egg-info/PKG-INFO b/pexif.egg-info/PKG-INFO new file mode 100644 index 0000000..18c33a5 --- /dev/null +++ b/pexif.egg-info/PKG-INFO @@ -0,0 +1,16 @@ +Metadata-Version: 1.1 +Name: pexif +Version: 0.15 +Summary: A module for editing JPEG EXIF data +Home-page: http://www.benno.id.au/code/pexif/ +Author: Ben Leslie +Author-email: benno@benno.id.au +License: http://www.opensource.org/licenses/mit-license.php +Description: This module allows you to parse and edit the EXIF data tags in a JPEG image. +Platform: any +Classifier: Development Status :: 4 - Beta +Classifier: Intended Audience :: Developers +Classifier: Operating System :: OS Independent +Classifier: Programming Language :: Python +Classifier: License :: OSI Approved :: Python Software Foundation License +Classifier: Topic :: Multimedia :: Graphics diff --git a/pexif.egg-info/SOURCES.txt b/pexif.egg-info/SOURCES.txt new file mode 100644 index 0000000..e01d65f --- /dev/null +++ b/pexif.egg-info/SOURCES.txt @@ -0,0 +1,20 @@ +MANIFEST.in +README +pexif.py +pexif.egg-info/PKG-INFO +pexif.egg-info/SOURCES.txt +pexif.egg-info/dependency_links.txt +pexif.egg-info/top_level.txt +scripts/dump_exif.py +scripts/getgps.py +scripts/noop.py +scripts/remove_metadata.py +scripts/setgps.py +scripts/timezone.py +test/test.py +test/data/conker.jpg +test/data/conker.txt +test/data/noexif.jpg +test/data/noexif.txt +test/data/rose.jpg +test/data/rose.txt \ No newline at end of file diff --git a/pexif.egg-info/dependency_links.txt b/pexif.egg-info/dependency_links.txt new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/pexif.egg-info/dependency_links.txt @@ -0,0 +1 @@ + diff --git a/pexif.egg-info/top_level.txt b/pexif.egg-info/top_level.txt new file mode 100644 index 0000000..c1de559 --- /dev/null +++ b/pexif.egg-info/top_level.txt @@ -0,0 +1 @@ +pexif diff --git a/pexif.py b/pexif.py index 250c719..67e531b 100644 --- a/pexif.py +++ b/pexif.py @@ -675,6 +675,18 @@ class IfdGPS(IfdData): 0x10: ("Image Direction: [T]rue or [M]agnetic", "GPSImgDirectionRef", ASCII, 2), 0x11: ("Image Direction: (0.00 to 359.99)", "GPSImgDirection", RATIONAL, 1), 0x12: ("Datum: WGS-84", "GPSMapDatum", ASCII), + ## 13 MISSING + ## 14 MISSING + ## 15 MISSING + ## 16 MISSING + 0x17: ("Destination Bearing: [T]rue or [M]agnetic", "GPSDestBearingRef", ASCII, 2), + 0x18: ("Destination Bearing: (0.00 to 359.99)", "GPSDestBearing", RATIONAL, 1), + ## 19 MISSING + ## 1A MISSING + ## 1B MISSING + ## 1C MISSING + ## 1D MISSING + ## 1E MISSING } def __init__(self, e, offset, exif_file, mode, data=None): @@ -1217,12 +1229,36 @@ def _parse(val): _parse = staticmethod(_parse) - def set_geo(self, lat, lng): + def set_altitude(self, elevation): + """Set the elevation""" + + gps = self.exif.primary.GPS + gps.GPSAltitude = [Rational(elevation, 1)] + gps.GPSAltitudeRef = '0' if elevation >= 0 else '1' + + def set_direction(self, direction, ref='T'): + """Set the image direction""" + + gps = self.exif.primary.GPS + gps.GPSImgDirection = [Rational(direction, 1)] + gps.GPSImgDirectionRef = ref + + def set_bearing(self, bearing, ref='T'): + """Set the image bearing""" + + gps = self.exif.primary.GPS + gps.GPSDestBearing = [Rational(bearing, 1)] + gps.GPSDestBearingRef = ref + + def set_geo(self, lat, lng, datum='WGS-84'): """Set the GeoLocation to a given lat and lng""" + if self.mode != "rw": raise RWError gps = self.exif.primary.GPS + gps.GPSMapDatum = datum + gps.GPSVersionID = '2 0 0 0' sign, deg, min, sec = JpegFile._parse(lat) ref = "N" From 249b8a53c2ad9268c8a1c53127e2e24ec9ff4cc1 Mon Sep 17 00:00:00 2001 From: DenisCarriere Date: Sun, 8 Feb 2015 04:11:25 -0500 Subject: [PATCH 3/4] Add Git Ignore --- .gitignore | 57 ++++++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 53 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index 5b1b935..db4561e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,54 @@ -*.pyc -build -dist -MANIFEST +# Byte-compiled / optimized / DLL files +__pycache__/ +*.py[cod] +# C extensions +*.so + +# Distribution / packaging +.Python +env/ +build/ +develop-eggs/ +dist/ +downloads/ +eggs/ +lib/ +lib64/ +parts/ +sdist/ +var/ +*.egg-info/ +.installed.cfg +*.egg + +# PyInstaller +# Usually these files are written by a python script from a template +# before PyInstaller builds the exe, so as to inject date/other infos into it. +*.manifest +*.spec + +# Installer logs +pip-log.txt +pip-delete-this-directory.txt + +# Unit test / coverage reports +htmlcov/ +.tox/ +.coverage +.cache +nosetests.xml +coverage.xml + +# Translations +*.mo +*.pot + +# Django stuff: +*.log + +# Sphinx documentation +docs/_build/ + +# PyBuilder +target/ From 467089c8fa5cc231271715d9d206d6d1457050e4 Mon Sep 17 00:00:00 2001 From: DenisCarriere Date: Sun, 8 Feb 2015 04:12:33 -0500 Subject: [PATCH 4/4] Remove Egg --- pexif.egg-info/PKG-INFO | 16 ---------------- pexif.egg-info/SOURCES.txt | 20 -------------------- pexif.egg-info/dependency_links.txt | 1 - pexif.egg-info/top_level.txt | 1 - 4 files changed, 38 deletions(-) delete mode 100644 pexif.egg-info/PKG-INFO delete mode 100644 pexif.egg-info/SOURCES.txt delete mode 100644 pexif.egg-info/dependency_links.txt delete mode 100644 pexif.egg-info/top_level.txt diff --git a/pexif.egg-info/PKG-INFO b/pexif.egg-info/PKG-INFO deleted file mode 100644 index 18c33a5..0000000 --- a/pexif.egg-info/PKG-INFO +++ /dev/null @@ -1,16 +0,0 @@ -Metadata-Version: 1.1 -Name: pexif -Version: 0.15 -Summary: A module for editing JPEG EXIF data -Home-page: http://www.benno.id.au/code/pexif/ -Author: Ben Leslie -Author-email: benno@benno.id.au -License: http://www.opensource.org/licenses/mit-license.php -Description: This module allows you to parse and edit the EXIF data tags in a JPEG image. -Platform: any -Classifier: Development Status :: 4 - Beta -Classifier: Intended Audience :: Developers -Classifier: Operating System :: OS Independent -Classifier: Programming Language :: Python -Classifier: License :: OSI Approved :: Python Software Foundation License -Classifier: Topic :: Multimedia :: Graphics diff --git a/pexif.egg-info/SOURCES.txt b/pexif.egg-info/SOURCES.txt deleted file mode 100644 index e01d65f..0000000 --- a/pexif.egg-info/SOURCES.txt +++ /dev/null @@ -1,20 +0,0 @@ -MANIFEST.in -README -pexif.py -pexif.egg-info/PKG-INFO -pexif.egg-info/SOURCES.txt -pexif.egg-info/dependency_links.txt -pexif.egg-info/top_level.txt -scripts/dump_exif.py -scripts/getgps.py -scripts/noop.py -scripts/remove_metadata.py -scripts/setgps.py -scripts/timezone.py -test/test.py -test/data/conker.jpg -test/data/conker.txt -test/data/noexif.jpg -test/data/noexif.txt -test/data/rose.jpg -test/data/rose.txt \ No newline at end of file diff --git a/pexif.egg-info/dependency_links.txt b/pexif.egg-info/dependency_links.txt deleted file mode 100644 index 8b13789..0000000 --- a/pexif.egg-info/dependency_links.txt +++ /dev/null @@ -1 +0,0 @@ - diff --git a/pexif.egg-info/top_level.txt b/pexif.egg-info/top_level.txt deleted file mode 100644 index c1de559..0000000 --- a/pexif.egg-info/top_level.txt +++ /dev/null @@ -1 +0,0 @@ -pexif