diff --git a/libmat2/images.py b/libmat2/images.py index 6066b07b2c60a32b96a58303a374d0e1b8ee6c27..2098569e17ada13dfe1d989a434f2aa727695cbc 100644 --- a/libmat2/images.py +++ b/libmat2/images.py @@ -112,6 +112,8 @@ class GdkPixbufAbstractParser(exiftool.ExiftoolParser): pixbuf = GdkPixbuf.Pixbuf.new_from_file(self.filename) if extension.lower() == '.jpg': extension = '.jpeg' # gdk is picky + elif extension.lower() == '.tif': + extension = '.tiff' # gdk is picky try: pixbuf.savev(self.output_filename, type=extension[1:], option_keys=[], option_values=[]) diff --git a/tests/test_corrupted_files.py b/tests/test_corrupted_files.py index 6dc80a43f9dcd5fe0dfc93fa05af5f951ed59460..d4b40a5382125a5fed0999e47b59cda7e3fa290b 100644 --- a/tests/test_corrupted_files.py +++ b/tests/test_corrupted_files.py @@ -187,6 +187,15 @@ class TestCorruptedFiles(unittest.TestCase): audio.MP3Parser('./tests/data/clean.mp3') os.remove('./tests/data/clean.mp3') + def test_wrong_tif(self): + shutil.copy('./tests/data/dirty.tiff', './tests/data/clean.tif') + p = images.TiffParser('./tests/data/clean.tif') + p.remove_all() + p = images.TiffParser('./tests/data/clean.cleaned.tif') + self.assertEqual(p.get_meta(), {}) + os.remove('./tests/data/clean.tif') + os.remove('./tests/data/clean.cleaned.tif') + def test_jpg(self): shutil.copy('./tests/data/dirty.mp3', './tests/data/clean.jpg') with self.assertRaises(ValueError):