New setting to disable autorotation of images, and warn about the

incompatibility between autorotation and EXIF copy (ref #72).
This commit is contained in:
Simon Conseil
2014-03-11 00:05:34 +01:00
parent befc3581c4
commit 07f0c42396
4 changed files with 21 additions and 6 deletions

View File

@@ -20,6 +20,8 @@ Released on 2014-xx-xx.
- New settings to define the sort order for albums and medias:
``albums_sort_reverse``, ``medias_sort_attr``, ``medias_sort_reverse``.
- New setting ``autorotate_images`` to disable autorotation of images, and warn
about the incompatibility between autorotation and EXIF copy.
Version 0.6.0
~~~~~~~~~~~~~

View File

@@ -64,6 +64,11 @@ def generate_image(source, outname, settings, options=None):
img = PILImage.open(source)
original_format = img.format
if settings['copy_exif_data'] and settings['autorotate_images']:
logger.warning("The 'autorotate_images' and 'copy_exif_data' settings "
"are not compatible because Sigal can't save the "
"modified Orientation tag.")
# Preserve EXIF data
if settings['copy_exif_data'] and _has_exif_tags(img):
if options is not None:
@@ -73,10 +78,11 @@ def generate_image(source, outname, settings, options=None):
options['exif'] = img.info['exif']
# Rotate the img, and catch IOError when PIL fails to read EXIF
try:
img = Transpose().process(img)
except (IOError, IndexError):
pass
if settings['autorotate_images']:
try:
img = Transpose().process(img)
except (IOError, IndexError):
pass
# Resize the image
if settings['img_processor']:

View File

@@ -32,7 +32,8 @@ _DEFAULT_CONFIG = {
'adjust_options': {'color': 1.0, 'brightness': 1.0,
'contrast': 1.0, 'sharpness': 1.0},
'albums_sort_reverse': False,
'copy_exif_data': True,
'autorotate_images': True,
'copy_exif_data': False,
'copyright': '',
'destination': '_build',
'files_to_copy': (),

View File

@@ -107,8 +107,14 @@ medias_sort_reverse = False
# contain all original files.
# zip_gallery = False # False or 'archive.zip'
# Autorotate images
# Warning: this setting is not compatible with `copy_exif_data` (see below),
# because Sigal can't save the modified Orientation tag (currently Pillow can't
# write EXIF).
# autorotate_images = True
# If True, EXIF data from the original image is copied to the resized image
# copy_exif_data = True
# copy_exif_data = False
# Specify a different locale. If set to '', the default locale is used.
# locale = ''