Merge branch 'master' into devel

This commit is contained in:
John Evans 2013-06-07 07:56:08 -04:00
commit 8c250013c8
5 changed files with 45 additions and 46 deletions

View file

@ -1,3 +1,6 @@
Jun 06, 2013 - v0.1.6 Exif classes made private. Refactored IFD post
processing. Corrected omission of Exif in UUIDBox docstring.
Jun 06, 2013 - v0.1.5 Changed ColourSpecificationBox attribute "color_space"
to "colorspace". Fixed MANIFEST issue affecting PyPI installs.

View file

@ -78,7 +78,7 @@ copyright = u'2013, John Evans'
# The short X.Y version.
version = '0.1'
# The full version, including alpha/beta/rc tags.
release = '0.1.5'
release = '0.1.6'
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.

View file

@ -142,18 +142,25 @@ From this point forward, python3 will be referred to as just "python".
Installation
============
First, get the code by going to either of
You can install glymur via pip from the command line::
$ pip install glymur
or manually retrieve the code from either of GitHub or PyPI
* https://pypi.python.org/pypi/Glymur/ (stable releases)
* http://github.com/quintusdias/glymur (bleeding edge)
and then unpack and install with::
$ python setup.py install --prefix=/install/path
In addition to merely installing glymur, you should adjust your **$PATH**
environment variable in order to be able to use the *jp2dump* script from
the unix command line.
::
$ python setup.py install --prefix=/install/path
$ export PYTHONPATH=/install/path/lib/python3.3/site-packages
$ export PATH=/install/path/bin:$PATH

View file

@ -1669,28 +1669,28 @@ class Exif:
offset = data[3]
# This is the 'Exif Image' portion.
exif = ExifImageIfd(self.endian, buffer[6:], offset)
self.exif_image = exif.ifd
exif = _ExifImageIfd(self.endian, buffer[6:], offset)
self.exif_image = exif.processed_ifd
if 'ExifTag' in self.exif_image.keys():
offset = self.exif_image['ExifTag']
photo = ExifPhotoIfd(self.endian, buffer[6:], offset)
self.exif_photo = photo.ifd
photo = _ExifPhotoIfd(self.endian, buffer[6:], offset)
self.exif_photo = photo.processed_ifd
if 'InteroperabilityTag' in self.exif_photo.keys():
offset = self.exif_photo['InteroperabilityTag']
interop = ExifInteroperabilityIfd(self.endian,
buffer[6:],
offset)
self.iop = interop.ifd
interop = _ExifInteroperabilityIfd(self.endian,
buffer[6:],
offset)
self.iop = interop.processed_ifd
if 'GPSTag' in self.exif_image.keys():
offset = self.exif_image['GPSTag']
gps = ExifGPSInfoIfd(self.endian, buffer[6:], offset)
self.exif_gpsinfo = gps.ifd
gps = _ExifGPSInfoIfd(self.endian, buffer[6:], offset)
self.exif_gpsinfo = gps.processed_ifd
class Ifd:
class _Ifd:
"""
Attributes
----------
@ -1705,6 +1705,8 @@ class Ifd:
Number of tags in the IFD.
raw_ifd : dictionary
Maps tag number to "mildly-interpreted" tag value.
processed_ifd : dictionary
Maps tag name to "mildly-interpreted" tag value.
"""
datatype2fmt = {1: ('B', 1),
2: ('B', 1),
@ -1718,6 +1720,7 @@ class Ifd:
def __init__(self, endian, buffer, offset):
self.endian = endian
self.buffer = buffer
self.processed_ifd = {}
self.num_tags, = struct.unpack(endian + 'H',
buffer[offset:offset + 2])
@ -1774,8 +1777,13 @@ class Ifd:
return payload
def post_process(self, tagnum2name):
for tag, value in self.raw_ifd.items():
tag_name = tagnum2name[tag]
self.processed_ifd[tag_name] = value
class ExifImageIfd(Ifd):
class _ExifImageIfd(_Ifd):
"""
Attributes
----------
@ -1990,16 +1998,11 @@ class ExifImageIfd(Ifd):
51041: 'NoiseProfile'}
def __init__(self, endian, buffer, offset):
Ifd.__init__(self, endian, buffer, offset)
# Now post process the raw IFD.
self.ifd = {}
for tag, value in self.raw_ifd.items():
tag_name = self.tagnum2name[tag]
self.ifd[tag_name] = value
_Ifd.__init__(self, endian, buffer, offset)
self.post_process(self.tagnum2name)
class ExifPhotoIfd(Ifd):
class _ExifPhotoIfd(_Ifd):
tagnum2name = {33434: 'ExposureTime',
33437: 'FNumber',
34850: 'ExposureProgram',
@ -2071,16 +2074,11 @@ class ExifPhotoIfd(Ifd):
42037: 'LensSerialNumber'}
def __init__(self, endian, buffer, offset):
Ifd.__init__(self, endian, buffer, offset)
# Now post process the raw IFD.
self.ifd = {}
for tag, value in self.raw_ifd.items():
tag_name = self.tagnum2name[tag]
self.ifd[tag_name] = value
_Ifd.__init__(self, endian, buffer, offset)
self.post_process(self.tagnum2name)
class ExifGPSInfoIfd(Ifd):
class _ExifGPSInfoIfd(_Ifd):
tagnum2name = {0: 'GPSVersionID',
1: 'GPSLatitudeRef',
2: 'GPSLatitude',
@ -2114,16 +2112,11 @@ class ExifGPSInfoIfd(Ifd):
30: 'GPSDifferential'}
def __init__(self, endian, buffer, offset):
Ifd.__init__(self, endian, buffer, offset)
# Now post process the raw IFD.
self.ifd = {}
for tag, value in self.raw_ifd.items():
tag_name = self.tagnum2name[tag]
self.ifd[tag_name] = value
_Ifd.__init__(self, endian, buffer, offset)
self.post_process(self.tagnum2name)
class ExifInteroperabilityIfd(Ifd):
class _ExifInteroperabilityIfd(_Ifd):
tagnum2name = {1: 'InteroperabilityIndex',
2: 'InteroperabilityVersion',
4096: 'RelatedImageFileFormat',
@ -2131,13 +2124,9 @@ class ExifInteroperabilityIfd(Ifd):
4098: 'RelatedImageLength'}
def __init__(self, endian, buffer, offset):
Ifd.__init__(self, endian, buffer, offset)
_Ifd.__init__(self, endian, buffer, offset)
self.post_process(self.tagnum2name)
# Now post process the raw IFD.
self.ifd = {}
for tag, value in self.raw_ifd.items():
tag_name = self.tagnum2name[tag]
self.ifd[tag_name] = value
# Map each box ID to the corresponding class.
_box_with_id = {

View file

@ -1,7 +1,7 @@
from distutils.core import setup
kwargs = {'name': 'Glymur',
'version': '0.1.5',
'version': '0.1.6',
'description': 'Tools for accessing JPEG2000 files',
'long_description': open('README.md').read(),
'author': 'John Evans',