def resize_image(entry, filename, new_path, exif_tags, workdir, new_size,
size_limits=(0, 0)):
- """Store a resized version of an image and return its pathname.
+ """
+ Store a resized version of an image and return its pathname.
Arguments:
entry -- the entry for the image to resize
'EXIF UserComment',
]
+
def exif_image_needs_rotation(exif_tags):
"""
Returns True if EXIF orientation requires rotation
return 'Image Orientation' in exif_tags \
and exif_tags['Image Orientation'].values[0] != 1
+
def exif_fix_image_orientation(im, exif_tags):
"""
Translate any EXIF orientation to raw orientation
- REDUCES IMAGE QUALITY by recompressig it
Pros:
- - Cures my neck pain
+ - Prevents neck pain
"""
# Rotate image
if 'Image Orientation' in exif_tags:
return im
+
def extract_exif(filename):
"""
Returns EXIF tags found in file at ``filename``
return exif_tags
+
def clean_exif(exif):
'''
Clean the result from anything the database cannot handle
return clean_exif
+
def _ifd_tag_to_dict(tag):
data = {
'printable': tag.printable,
return data
+
def _ratio_to_list(ratio):
return [ratio.num, ratio.den]
+
def get_useful(tags):
useful = {}
for key, tag in tags.items():
useful[key] = tag
return useful
-
+
def get_gps_data(tags):
"""
gps_data[key] = (
lambda v:
float(v[0].num) / float(v[0].den) \
- + (float(v[1].num) / float(v[1].den) / 60 )\
+ + (float(v[1].num) / float(v[1].den) / 60) \
+ (float(v[2].num) / float(v[2].den) / (60 * 60))
)(dat.values)
+
+ if tags['GPS GPSLongitudeRef'].values == 'W':
+ gps_data['longitude'] /= -1
+
except KeyError:
pass