Back to index

moin  1.9.0~rc2
Functions
MoinMoin.filter.image_jpeg Namespace Reference

Functions

def execute

Function Documentation

def MoinMoin.filter.image_jpeg.execute (   indexobj,
  filename 
)
Extract some EXIF data 

Definition at line 10 of file image_jpeg.py.

00010 
00011 def execute(indexobj, filename):
00012     """ Extract some EXIF data """
00013     try:
00014         f = file(filename, 'rb')
00015         tags = EXIF.process_file(f)
00016         f.close()
00017         # get rid of some big stuff:
00018         try:
00019             del tags["JPEGThumbnail"]
00020         except:
00021             pass
00022         try:
00023             del tags["EXIF MakerNote"]
00024         except:
00025             pass
00026         data = str(tags).decode('utf-8')
00027     except (ValueError, TypeError, KeyError): # EXIF throws ValueError on unknown tags
00028                                               # TypeError on other occassions
00029                                               # KeyError too
00030         data = u''
00031     return data
00032