Browse Source

Make copying EXIF data optional

pull/25/head
Matthias Vogelgesang 13 years ago
parent
commit
1155d536b3
  1. 3
      sigal/gallery.py
  2. 13
      sigal/image.py
  3. 3
      sigal/settings.py
  4. 3
      sigal/templates/sigal.conf.py

3
sigal/gallery.py

@ -284,7 +284,8 @@ def process_image(filepath, outpath, settings):
sigal.image.generate_image(filepath, outname, settings['img_size'],
None, options=options, copyright_text=settings['copyright'],
method=settings['img_processor'])
method=settings['img_processor'],
copy_exif_data=settings['copy_exif_data'])
if settings['make_thumbs']:
thumb_name = join(outpath, get_thumb(settings, filename))

13
sigal/image.py

@ -32,7 +32,8 @@ from pilkit.utils import save_image
def generate_image(source, outname, size, format, options=None,
autoconvert=True, copyright_text='', method='ResizeToFit'):
autoconvert=True, copyright_text='', method='ResizeToFit',
copy_exif_data=True):
"""Image processor, rotate and resize the image.
:param source: path to an image
@ -45,13 +46,9 @@ def generate_image(source, outname, size, format, options=None,
original_format = img.format
# Preserve EXIF data
if hasattr(img, 'info') and 'exif' in img.info:
raw_exif = img.info['exif']
if options:
options['exif'] = raw_exif
else:
options = {'exif': raw_exif}
if copy_exif_data and hasattr(img, 'info') and 'exif' in img.info:
options = options or {}
options['exif'] = img.info['exif']
# Rotate the img, and catch IOError when PIL fails to read EXIF
try:

3
sigal/settings.py

@ -47,7 +47,8 @@ _DEFAULT_CONFIG = {
'index_in_url': False,
'zip_gallery': False,
'links': '',
'google_analytics': ''
'google_analytics': '',
'copy_exif_data': True
}

3
sigal/templates/sigal.conf.py

@ -84,3 +84,6 @@ thumb_size = (280, 210)
# Set zip_gallery to either False or a file name. The final archive will
# contain all original files.
# zip_gallery = False # False or 'archive.zip'
# If True, EXIF data from the original image is copied to the resized image
# copy_exif_data = True

Loading…
Cancel
Save