Attachment 'EXIF_patch.patch'

Download

   1 --- C:\download\image\exif\EXIF.py	2006-07-06 21:12:10.000000000 +0200
   2 +++ EXIF.py	2006-07-25 14:34:15.336289800 +0200
   3 @@ -103,6 +103,11 @@
   4      (8, 'SR', 'Signed Ratio')
   5      )
   6  
   7 +def cu(x):
   8 +    if isinstance(x, str):
   9 +        return x
  10 +    return ''.join(map(chr, x))
  11 +
  12  # dictionary of main EXIF tag names
  13  # first element of tuple is tag name, optional second element is
  14  # another dictionary giving names to values
  15 @@ -177,7 +182,7 @@
  16      0x8827: ('ISOSpeedRatings', ),
  17      0x8828: ('OECF', ),
  18      # print as string
  19 -    0x9000: ('ExifVersion', lambda x: ''.join(map(chr, x))),
  20 +    0x9000: ('ExifVersion', cu),
  21      0x9003: ('DateTimeOriginal', ),
  22      0x9004: ('DateTimeDigitized', ),
  23      0x9101: ('ComponentsConfiguration',
  24 @@ -230,12 +235,13 @@
  25      0x920A: ('FocalLength', ),
  26      0x927C: ('MakerNote', ),
  27      # print as string
  28 -    0x9286: ('UserComment', lambda x: ''.join(map(chr, x))),
  29 +    0x9286: ('UserComment', cu),
  30 +#    0x9286: ('UserComment', ),
  31      0x9290: ('SubSecTime', ),
  32      0x9291: ('SubSecTimeOriginal', ),
  33      0x9292: ('SubSecTimeDigitized', ),
  34      # print as string
  35 -    0xA000: ('FlashPixVersion', lambda x: ''.join(map(chr, x))),
  36 +    0xA000: ('FlashPixVersion', cu),
  37      0xA001: ('ColorSpace', ),
  38      0xA002: ('ExifImageWidth', ),
  39      0xA003: ('ExifImageLength', ),
  40 @@ -390,18 +396,21 @@
  41  
  42  # decode Olympus SpecialMode tag in MakerNote
  43  def olympus_special_mode(v):
  44 -    a={
  45 -        0: 'Normal',
  46 -        1: 'Unknown',
  47 -        2: 'Fast',
  48 -        3: 'Panorama'}
  49 -    b={
  50 -        0: 'Non-panoramic',
  51 -        1: 'Left to right',
  52 -        2: 'Right to left',
  53 -        3: 'Bottom to top',
  54 -        4: 'Top to bottom'}
  55 -    return '%s - sequence %d - %s' % (a[v[0]], v[1], b[v[2]])
  56 +    try:
  57 +        a={
  58 +            0: 'Normal',
  59 +            1: 'Unknown',
  60 +            2: 'Fast',
  61 +            3: 'Panorama'}
  62 +        b={
  63 +            0: 'Non-panoramic',
  64 +            1: 'Left to right',
  65 +            2: 'Right to left',
  66 +            3: 'Bottom to top',
  67 +            4: 'Top to bottom'}
  68 +        return '%s - sequence %d - %s' % (a[v[0]], v[1], b[v[2]])
  69 +    except KeyError:
  70 +        return v
  71          
  72  MAKERNOTE_OLYMPUS_TAGS={
  73      # ah HAH! those sneeeeeaky bastids! this is how they get past the fact
  74 @@ -419,7 +428,7 @@
  75      0x0207: ('SoftwareRelease',  ),
  76      0x0208: ('PictureInfo',  ),
  77      # print as string
  78 -    0x0209: ('CameraID', lambda x: ''.join(map(chr, x))),
  79 +    0x0209: ('CameraID', cu),
  80      0x0F00: ('DataDump',  )
  81      }
  82  
  83 @@ -478,7 +487,7 @@
  84      }
  85  
  86  MAKERNOTE_FUJIFILM_TAGS={
  87 -    0x0000: ('NoteVersion', lambda x: ''.join(map(chr, x))),
  88 +    0x0000: ('NoteVersion', cu),
  89      0x1000: ('Quality', ),
  90      0x1001: ('Sharpness',
  91               {1: 'Soft',

Attached Files

To refer to attachments on a page, use attachment:filename, as shown below in the list of files. Do NOT use the URL of the [get] link, since this is subject to change and can break easily.
  • [get | view] (2006-07-27 13:28:42, 41.0 KB) [[attachment:EXIF.py]]
  • [get | view] (2006-07-27 18:28:39, 2.8 KB) [[attachment:EXIF_patch.patch]]
  • [get | view] (2006-07-27 18:29:41, 50.5 KB) [[attachment:Gallery.patch]]
  • [get | view] (2006-07-27 19:15:39, 25.6 KB) [[attachment:Gallery2.patch]]
  • [get | view] (2006-07-27 13:33:03, 3175.6 KB) [[attachment:Gallery2_additional_files_win32.zip]]
  • [get | view] (2006-07-27 18:25:50, 4.5 KB) [[attachment:if_modified_since.patch]]
 All files | Selected Files: delete move to page copy to page

You are not allowed to attach a file to this page.