Changeset 3643

Show
Ignore:
Timestamp:
19/10/08 16:16:11 (3 months ago)
Author:
tack
Message:

Make EXIF a bit more robust: fixes parse failures for EXIF test images at
https://sourceforge.net/project/showfiles.php?group_id=187210

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/metadata/src/image/EXIF.py

    r3360 r3643  
    12491249 
    12501250        # add pixel strips and update strip offset info 
    1251         old_offsets = self.tags['Thumbnail StripOffsets'].values 
    1252         old_counts = self.tags['Thumbnail StripByteCounts'].values 
     1251        # kaa.metadata addition: wrap key access in try/except in case 
     1252        # keys do not exist, in which case we cannot extract TIFF thumbnail 
     1253        try: 
     1254            old_offsets = self.tags['Thumbnail StripOffsets'].values 
     1255            old_counts = self.tags['Thumbnail StripByteCounts'].values 
     1256        except KeyError: 
     1257            return 
     1258 
    12531259        for i in range(len(old_offsets)): 
    12541260            # update offset pointer (more nasty "strings are immutable" crap) 
     
    14651471 
    14661472    # deal with MakerNote contained in EXIF IFD 
    1467     if 'EXIF MakerNote' in hdr.tags and detailed: 
     1473    # kaa.metadata addition: also test 'Image Make' in hdr.tags before 
     1474    # calling decode_maker_note(). 
     1475    if 'EXIF MakerNote' in hdr.tags and 'Image Make' in hdr.tags and detailed: 
    14681476        hdr.decode_maker_note() 
    14691477