Add support for exif tags by EXIF.py
EXIF.py is a read-only library for exif tags. It's pure python, so it can always be present. It seems better than PIL built-in support. Maybe we can drop support for Pexif and Zexif.
It's available from http://
Whiteboard
$ bzr diff
=== modified file 'copyright'
--- copyright 2009-05-28 16:14:00 +0000
+++ copyright 2009-05-29 16:25:21 +0000
@@ -117,6 +117,38 @@
NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
THE USE OR PERFORMANCE OF THIS SOFTWARE.
+The file phatch/
+ Copyright (c) 2002-2007 Gene Cash All rights reserved
+ Copyright (c) 2007-2008 Ianaré Sévi All rights reserved
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ 1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above
+ copyright notice, this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided
+ with the distribution.
+
+ 3. Neither the name of the authors nor the names of its contributors
+ may be used to endorse or promote products derived from this
+ software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
The file phatch/
licensed under its license:
=== modified file 'phatch/
--- phatch/core/pil.py 2009-05-29 13:40:01 +0000
+++ phatch/core/pil.py 2009-05-29 16:19:18 +0000
@@ -23,6 +23,8 @@
from cStringIO import StringIO
from urllib2 import urlopen
+import EXIF
+
import Image
try:
from ExifTags import TAGS as EXIFTAGS
@@ -175,6 +177,25 @@
+
+def fix_EXIF(tag):
+ if not (tag.startswith
+ print tag
+ tag = 'EXIF.'+tag
+ return tag.replace(' ',DOT)
+
+def extract_
+ if not os.path.
+ return
+ f = open(location, 'rb')
+ try:
+ tags = EXIF.process_
+ except:
+ tags = {}
+ f.close()
+ for tag, value in tags.items():
+ if tag != 'EXIF UserComment':
+ info[fix_EXIF(tag)] = value
def extract_
if not location.strip():
@@ -211,7 +232,8 @@
info[
#load Pil info
for key, value in image.info.items():
- info['Pil'+DOT+key] = value
+ if key!='exif':
+ info['Pil'
#retrieve properties
width, height = size = image.size
#summarize all photo properties in info
@@ -236,6 +258,7 @@
if metadata:
+ extract_
return info
def prefix_
=== modified file 'phatch/
--- phatch/
+++ phatch/
@@ -36,7 +36,7 @@
TAGS = [SELECT, ALL,'Pil']
if pyexiv2:
TAGS.
-TAGS.extend(
+TAGS.extend(
WX_ENCODING = wx.GetDefaultPy
def shortcut(key):