Пример #1
0
 def get_properties(self):
     file = StringIO(self.file)
     exif = EXIF.process_file(file)
     def get_exif_property(name):
         return exif.has_key(name) and exif[name] or None
     make = get_exif_property("Image Make")
     model = get_exif_property("Image Model")
     camera = "%s, %s" % (make, model)
     return [{'name': "Location", 'value': self.location},
             {'name': "Description", 'value': self.description},
             {'name': "Shutter speed", 'value': get_exif_property("EXIF ExposureTime")},
             {'name': "F number", 'value': get_exif_property("EXIF FNumber")},
             {'name': "Focal length", 'value': get_exif_property("EXIF FocalLength")},
             {'name': "ISO", 'value': get_exif_property("EXIF ISOSpeedRatings")},
             {'name': "Flash", 'value': get_exif_property("EXIF Flash")},
             {'name': "Camera", 'value': camera},
             {'name': "Date taken", 'value': get_exif_property("EXIF DateTimeOriginal")}]
Пример #2
0
    def get_properties(self):
        file = StringIO(self.file)
        exif = EXIF.process_file(file)

        def get_exif_property(name):
            return exif.has_key(name) and exif[name] or None

        make = get_exif_property("Image Make")
        model = get_exif_property("Image Model")
        camera = "%s, %s" % (make, model)
        return [{
            'name': "Location",
            'value': self.location
        }, {
            'name': "Description",
            'value': self.description
        }, {
            'name': "Shutter speed",
            'value': get_exif_property("EXIF ExposureTime")
        }, {
            'name': "F number",
            'value': get_exif_property("EXIF FNumber")
        }, {
            'name': "Focal length",
            'value': get_exif_property("EXIF FocalLength")
        }, {
            'name': "ISO",
            'value': get_exif_property("EXIF ISOSpeedRatings")
        }, {
            'name': "Flash",
            'value': get_exif_property("EXIF Flash")
        }, {
            'name': "Camera",
            'value': camera
        }, {
            'name': "Date taken",
            'value': get_exif_property("EXIF DateTimeOriginal")
        }]
Пример #3
0
def _read_EXIF(fobj):
    return EXIF.process_file(fobj)
Пример #4
0
    location = "/Users/sajnikanth/Dropbox/Photos 0001-0097/"

# Look for JPG images in that location
jpg_files = []
for root, dirnames, filenames in os.walk(location):
    for filename in fnmatch.filter(filenames, '*.jpg'):
        jpg_files.append(os.path.join(root, filename))

# If there are JPG images in that location
if len(jpg_files) > 0:

    # Get EXIF from all images in that location
    raw_data_from_jpg_files = {}
    fail_counter = 0
    for i in range(0, len(jpg_files)):
        raw_data_from_jpg_files[jpg_files[i]] = EXIF.process_file(open(jpg_files[i]))  # raw_data_from_jpg_files now has {filename1_with_path:{exif_info1:exif_value1, exif_info2:exif_value2}, filename2_with_path....}
        filename = jpg_files[i].split("/")[(len(jpg_files[i].split("/"))-1)]
        parent_directory = jpg_files[i].split("/")[(len(jpg_files[i].split("/"))-2)]
        # Check if there's a Date field in EXIF
        if any("Date" in s for s in raw_data_from_jpg_files.get(jpg_files[i]).keys()):
            pass
        else:
            open("failures.log", "a").write(parent_directory + "/" + filename + "\n")
            fail_counter +=1

    # Get Dates for all images and dump them in results.csv
    pass_counter = 0
    open("results.csv", "a").write("File Name,Date,Time\n")
    for file_name in raw_data_from_jpg_files:
        jpg_exif_info = raw_data_from_jpg_files[file_name].keys()  # create a list of exif_info
        for i in range(0, len(jpg_exif_info)):