1
0
mirror of synced 2024-11-24 10:14:24 +01:00

Handle tiff images with a .tif extension

This commit is contained in:
jvoisin 2019-12-16 14:55:35 -08:00
parent f5aef1b391
commit 7465cedee7
2 changed files with 11 additions and 0 deletions

View File

@ -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=[])

View File

@ -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):