Ejemplo n.º 1
0
def read_image_description_general(test_obj, filename):
    exif_data_PIL = load_exif_PIL()
    image_description_PIL = str(
        exif_data_PIL[EXIF_PRIMARY_TAGS_DICT["ImageDescription"]])
    exif_data_ExifRead = ExifRead(filename)
    image_description_ExifRead = str(
        exif_data_ExifRead.extract_image_description())
    test_obj.assertEqual(image_description_ExifRead, image_description_PIL)
Ejemplo n.º 2
0
def read_orientation_general(test_obj, filename):
    exif_data_PIL = load_exif_PIL()
    orientation_PIL = exif_data_PIL[EXIF_PRIMARY_TAGS_DICT["Orientation"]]

    exif_data_ExifRead = ExifRead(filename)
    orientation_ExifRead = exif_data_ExifRead.extract_orientation()

    test_obj.assertEqual(orientation_PIL, orientation_ExifRead)
Ejemplo n.º 3
0
def read_image_history_general(test_obj, filename):
    exif_data_PIL = load_exif_PIL()
    image_history_PIL = str(
        exif_data_PIL[EXIF_PRIMARY_TAGS_DICT["ImageHistory"]])

    exif_data_ExifRead = ExifRead(filename)
    image_history_ExifRead = str(exif_data_ExifRead.extract_image_history())

    test_obj.assertEqual(image_history_ExifRead, image_history_PIL)
Ejemplo n.º 4
0
def read_orientation_general(test_obj, filename):

    exif_data_PIL = load_exif_PIL()
    orientation_PIL = exif_data_PIL[EXIF_PRIMARY_TAGS_DICT['Orientation']]

    exif_data_ExifRead = ExifRead(filename)
    orientation_ExifRead = exif_data_ExifRead.extract_orientation()

    test_obj.assertEqual(orientation_PIL, orientation_ExifRead)
Ejemplo n.º 5
0
def read_altitude_general(test_obj, filename):
    exif_data_PIL = load_exif_PIL()
    altitude_PIL = exif_data_PIL[EXIF_PRIMARY_TAGS_DICT["GPSInfo"]][
        EXIF_GPS_TAGS_DICT["GPSAltitude"]]
    altitude_value_PIL = altitude_PIL.numerator / altitude_PIL.denominator

    exif_data_ExifRead = ExifRead(filename)
    altitude_ExifRead = exif_data_ExifRead.extract_altitude()

    test_obj.assertEqual(altitude_value_PIL, altitude_ExifRead)
Ejemplo n.º 6
0
def read_direction_general(test_obj, filename):
    exif_data_PIL = load_exif_PIL()
    direction_PIL = exif_data_PIL[EXIF_PRIMARY_TAGS_DICT["GPSInfo"]][
        EXIF_GPS_TAGS_DICT["GPSImgDirection"]]
    direction_value_PIL = direction_PIL.numerator / direction_PIL.denominator

    exif_data_ExifRead = ExifRead(filename)
    direction_ExifRead = exif_data_ExifRead.extract_direction()

    test_obj.assertEqual(direction_value_PIL, direction_ExifRead)
Ejemplo n.º 7
0
def read_altitude_general(test_obj, filename):

    exif_data_PIL = load_exif_PIL()
    altitude_PIL = exif_data_PIL[EXIF_PRIMARY_TAGS_DICT['GPSInfo']][
        EXIF_GPS_TAGS_DICT['GPSAltitude']]
    altitude_PIL = altitude_PIL[0] / float(altitude_PIL[1])

    exif_data_ExifRead = ExifRead(filename)
    altitude_ExifRead = exif_data_ExifRead.extract_altitude()

    test_obj.assertEqual(altitude_PIL, altitude_ExifRead)
Ejemplo n.º 8
0
def read_date_time_original_general(test_obj, filename):

    exif_data_PIL = load_exif_PIL()
    capture_time_PIL = exif_data_PIL[EXIF_PRIMARY_TAGS_DICT['DateTimeOriginal']]

    exif_data_ExifRead = ExifRead(filename)
    capture_time_ExifRead = exif_data_ExifRead.extract_capture_time()
    capture_time_ExifRead = capture_time_ExifRead.strftime("%Y:%m:%d %H:%M:%S.%f")[
        :-3]

    test_obj.assertEqual(capture_time_PIL, capture_time_ExifRead)
Ejemplo n.º 9
0
def read_image_history_general(test_obj, filename):

    exif_data_PIL = load_exif_PIL()
    image_history_PIL = str(
        exif_data_PIL[EXIF_PRIMARY_TAGS_DICT['ImageHistory']])

    exif_data_ExifRead = ExifRead(filename)
    image_history_ExifRead = str(
        exif_data_ExifRead.extract_image_history())

    test_obj.assertEqual(image_history_ExifRead, image_history_PIL)
Ejemplo n.º 10
0
def read_image_description_general(test_obj, filename):

    exif_data_PIL = load_exif_PIL()
    image_description_PIL = str(
        exif_data_PIL[EXIF_PRIMARY_TAGS_DICT['ImageDescription']])

    exif_data_ExifRead = ExifRead(filename)
    image_description_ExifRead = str(
        exif_data_ExifRead.extract_image_description())

    test_obj.assertEqual(image_description_ExifRead, image_description_PIL)
Ejemplo n.º 11
0
def read_direction_general(test_obj, filename):

    exif_data_PIL = load_exif_PIL()
    direction_PIL = exif_data_PIL[EXIF_PRIMARY_TAGS_DICT['GPSInfo']][
        EXIF_GPS_TAGS_DICT['GPSImgDirection']]
    direction_PIL = direction_PIL[0] / float(direction_PIL[1])

    exif_data_ExifRead = ExifRead(filename)
    direction_ExifRead = exif_data_ExifRead.extract_direction()

    test_obj.assertEqual(direction_PIL, direction_ExifRead)
Ejemplo n.º 12
0
def read_camera_make_model_general(test_obj, filename):
    exif_data_PIL = load_exif_PIL()
    make_PIL = exif_data_PIL[EXIF_PRIMARY_TAGS_DICT["Make"]]
    model_PIL = exif_data_PIL[EXIF_PRIMARY_TAGS_DICT["Model"]]

    exif_data_ExifRead = ExifRead(filename)
    make_ExifRead = exif_data_ExifRead.extract_make()
    model_ExifRead = exif_data_ExifRead.extract_model()

    test_obj.assertEqual((make_PIL, model_PIL),
                         (make_ExifRead, model_ExifRead))
Ejemplo n.º 13
0
def read_date_time_original_general(test_obj, filename):
    exif_data_PIL = load_exif_PIL()
    capture_time_PIL = exif_data_PIL[
        EXIF_PRIMARY_TAGS_DICT["DateTimeOriginal"]]

    exif_data_ExifRead = ExifRead(filename)
    capture_time_ExifRead = exif_data_ExifRead.extract_capture_time()
    capture_time_ExifRead = capture_time_ExifRead.strftime(
        "%Y:%m:%d %H:%M:%S.%f")[:-3]

    test_obj.assertEqual(capture_time_PIL, capture_time_ExifRead)
Ejemplo n.º 14
0
def read_camera_make_model_general(test_obj, filename):

    exif_data_PIL = load_exif_PIL()
    make_PIL = exif_data_PIL[EXIF_PRIMARY_TAGS_DICT['Make']]
    model_PIL = exif_data_PIL[EXIF_PRIMARY_TAGS_DICT['Model']]

    exif_data_ExifRead = ExifRead(filename)
    make_ExifRead = exif_data_ExifRead.extract_make()
    model_ExifRead = exif_data_ExifRead.extract_model()

    test_obj.assertEqual((make_PIL, model_PIL),
                         (make_ExifRead, model_ExifRead))
Ejemplo n.º 15
0
def read_direction_general(test_obj, filename):

    exif_data_PIL = load_exif_PIL()
    direction_PIL = exif_data_PIL[EXIF_PRIMARY_TAGS_DICT['GPSInfo']
                                  ][EXIF_GPS_TAGS_DICT['GPSImgDirection']]
    direction_PIL = direction_PIL[0] / float(direction_PIL[1])

    exif_data_ExifRead = ExifRead(filename)
    direction_ExifRead = exif_data_ExifRead.extract_direction()

    test_obj.assertEqual(direction_PIL,
                         direction_ExifRead)
Ejemplo n.º 16
0
def read_altitude_general(test_obj, filename):

    exif_data_PIL = load_exif_PIL()
    altitude_PIL = exif_data_PIL[EXIF_PRIMARY_TAGS_DICT['GPSInfo']
                                 ][EXIF_GPS_TAGS_DICT['GPSAltitude']]
    altitude_PIL = altitude_PIL[0] / float(altitude_PIL[1])

    exif_data_ExifRead = ExifRead(filename)
    altitude_ExifRead = exif_data_ExifRead.extract_altitude()

    test_obj.assertEqual(altitude_PIL,
                         altitude_ExifRead)
Ejemplo n.º 17
0
def read_lat_lon_general(test_obj, filename):
    exif_data_PIL = load_exif_PIL()
    latitude_PIL = exif_data_PIL[EXIF_PRIMARY_TAGS_DICT["GPSInfo"]][
        EXIF_GPS_TAGS_DICT["GPSLatitude"]]
    longitude_PIL = exif_data_PIL[EXIF_PRIMARY_TAGS_DICT["GPSInfo"]][
        EXIF_GPS_TAGS_DICT["GPSLongitude"]]
    latitudeRef_PIL = exif_data_PIL[EXIF_PRIMARY_TAGS_DICT["GPSInfo"]][
        EXIF_GPS_TAGS_DICT["GPSLatitudeRef"]]
    longitudeRef_PIL = exif_data_PIL[EXIF_PRIMARY_TAGS_DICT["GPSInfo"]][
        EXIF_GPS_TAGS_DICT["GPSLongitudeRef"]]

    latitude_PIL = gps_to_decimal(latitude_PIL, latitudeRef_PIL)
    longitude_PIL = gps_to_decimal(longitude_PIL, longitudeRef_PIL)

    exif_data_ExifRead = ExifRead(filename)
    longitude_ExifRead, latitude_ExifRead = exif_data_ExifRead.extract_lon_lat(
    )

    test_obj.assertEqual((latitude_PIL, longitude_PIL),
                         (latitude_ExifRead, longitude_ExifRead))
Ejemplo n.º 18
0
def read_lat_lon_general(test_obj, filename):

    exif_data_PIL = load_exif_PIL()
    latitude_PIL = exif_data_PIL[EXIF_PRIMARY_TAGS_DICT['GPSInfo']
                                 ][EXIF_GPS_TAGS_DICT['GPSLatitude']]
    longitude_PIL = exif_data_PIL[EXIF_PRIMARY_TAGS_DICT['GPSInfo']
                                  ][EXIF_GPS_TAGS_DICT['GPSLongitude']]
    latitudeRef_PIL = exif_data_PIL[EXIF_PRIMARY_TAGS_DICT['GPSInfo']
                                    ][EXIF_GPS_TAGS_DICT['GPSLatitudeRef']]
    longitudeRef_PIL = exif_data_PIL[EXIF_PRIMARY_TAGS_DICT['GPSInfo']
                                     ][EXIF_GPS_TAGS_DICT['GPSLongitudeRef']]

    latitude_PIL = gps_to_decimal(latitude_PIL, latitudeRef_PIL)
    longitude_PIL = gps_to_decimal(longitude_PIL, longitudeRef_PIL)

    exif_data_ExifRead = ExifRead(filename)
    longitude_ExifRead, latitude_ExifRead = exif_data_ExifRead.extract_lon_lat()

    test_obj.assertEqual((latitude_PIL, longitude_PIL),
                         (latitude_ExifRead, longitude_ExifRead))