diff --git a/docs/index.rst b/docs/index.rst index 342ab9c..6cbba19 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -58,7 +58,6 @@ Dependencies - Jinja2 - Python Imaging Library (PIL / Pillow) - Python Markdown -- pyexiv2 (optional, used to copy exif metadatas) How to Use diff --git a/sigal/gallery.py b/sigal/gallery.py index 12a258e..1db6233 100644 --- a/sigal/gallery.py +++ b/sigal/gallery.py @@ -33,7 +33,7 @@ from multiprocessing import Pool from os.path import join from PIL import Image as PILImage -from .image import Image, copy_exif +from .image import Image from .settings import get_thumb from .writer import Writer @@ -232,7 +232,7 @@ def worker_image(*args): def process_image(filepath, outpath, settings): - """Process one image: resize, create thumbnail, copy exif.""" + """Process one image: resize, create thumbnail.""" filename = os.path.split(filepath)[1] outname = join(outpath, filename) @@ -256,9 +256,6 @@ def process_image(filepath, outpath, settings): fit=settings['thumb_fit'], quality=settings['jpg_options']['quality']) - if settings['copy_exif']: - copy_exif(filepath, outname) - def get_metadata(path): """ Get album metadata from DESCRIPTION_FILE: diff --git a/sigal/image.py b/sigal/image.py index b7c7a4c..555d464 100644 --- a/sigal/image.py +++ b/sigal/image.py @@ -138,22 +138,3 @@ class quiet(object): os.dup2(self.old, self.stderr_fd) os.close(self.null_fd) os.close(self.old) - - -def copy_exif(srcfile, dstfile): - "Copy the exif metadatas from src to dest images" - - logger = logging.getLogger(__name__) - - import pyexiv2 - - src = pyexiv2.ImageMetadata(srcfile) - dst = pyexiv2.ImageMetadata(dstfile) - src.read() - dst.read() - try: - src.copy(dst) - except: - logger.error("metadata not copied for %s.", srcfile) - return - dst.write() diff --git a/sigal/settings.py b/sigal/settings.py index 7cb14fe..78e18ea 100644 --- a/sigal/settings.py +++ b/sigal/settings.py @@ -34,7 +34,6 @@ _DEFAULT_CONFIG = { 'keep_orig': False, 'orig_dir': 'original', 'jpg_options': {'quality': 85, 'optimize': True, 'progressive': True}, - 'copy_exif': False, 'copyright': '', 'ext_list': ['.jpg', '.jpeg', '.JPG', '.JPEG', '.png'], 'theme': 'colorbox', @@ -73,11 +72,4 @@ def read_settings(filename=None): logger.warning("The %s setting should be specified with the " "largest value first.", key) - if settings['copy_exif']: - try: - import pyexiv2 # NOQA - except ImportError: - settings['copy_exif'] = False - logger.error("Error: install pyexiv2 module to use exif metadatas") - return settings diff --git a/sigal/templates/sigal.conf.py b/sigal/templates/sigal.conf.py index 1075354..50aafd8 100644 --- a/sigal/templates/sigal.conf.py +++ b/sigal/templates/sigal.conf.py @@ -47,9 +47,6 @@ thumb_size = (280, 210) # links = [('Example link', 'http://example.org'), # ('Another link', 'http://example.org')] -# Keep exif metadatas in output image (default: False) -# copy_exif = True - # Add a copyright text on the image (default: '') # copyright = "An example copyright message" diff --git a/tests/sample/sigal.conf.py b/tests/sample/sigal.conf.py index 69d1520..2ab1605 100644 --- a/tests/sample/sigal.conf.py +++ b/tests/sample/sigal.conf.py @@ -7,5 +7,4 @@ keep_orig = True links = [('Example link', 'http://example.org'), ('Another link', 'http://example.org')] -copy_exif = True copyright = "An example copyright message" diff --git a/tests/test_image.py b/tests/test_image.py index 95c808a..17194cd 100644 --- a/tests/test_image.py +++ b/tests/test_image.py @@ -9,12 +9,7 @@ try: except ImportError: import unittest # NOQA -try: - import pyexiv2 -except ImportError: - pyexiv2 = False - -from sigal.image import copy_exif, Image +from sigal.image import Image CURRENT_DIR = os.path.dirname(__file__) TEST_IMAGE = 'exo20101028-b-full.jpg' @@ -38,28 +33,3 @@ class TestImage(unittest.TestCase): def test_save(self): self.img.save(self.dstfile) self.assertTrue(os.path.isfile(self.dstfile)) - - -@unittest.skipUnless(pyexiv2, "pyexiv2 isn't installed") -class TestExif(unittest.TestCase): - "Test the copy of exif metadata with pyexiv2." - - def setUp(self): - self.temp_path = mkdtemp() - self.srcfile = os.path.join(CURRENT_DIR, 'sample', 'dir2', TEST_IMAGE) - self.dstfile = os.path.join(self.temp_path, TEST_IMAGE) - - img = Image(self.srcfile) - img.save(self.dstfile) - copy_exif(self.srcfile, self.dstfile) - - def tearDown(self): - rmtree(self.temp_path) - - def test_exif(self): - src = pyexiv2.ImageMetadata(self.srcfile) - dst = pyexiv2.ImageMetadata(self.dstfile) - src.read() - dst.read() - - self.assertListEqual(src.keys(), dst.keys())